Alexander van Trijffel
Alexander van Trijffel

Reputation: 3006

Maximum file upload size Azure Web Application Firewall WAF

The documentation of the Azure Web Application Firewall (WAF) lists the following limits:

However, we are unable to upload files that are larger than 128 KB. Even when we change the WAF to Large SKU.

When sending an HTTP POST request with content-type multipart/form-data and a file of 2 MB, the request is rejected with error 413 Request Entity Too Large.

We used the following HTML form to upload files:

<form action="/upload" method="post" enctype="multipart/form-data">
  <div>
    <label for="image_uploads">Choose images to upload (PNG, JPG)</label>
    <input type="file" id="image_uploads" name="image_uploads" multiple>
  </div>
  <div class="preview">
    <p>No files currently selected for upload x</p>
  </div>
  <div>
    <button>Submit</button>
  </div>
</form>

With which method should we upload files so that the maximum file size will become 500 MB instead of 128 KB?

Upvotes: 3

Views: 4462

Answers (2)

Daniel Weil
Daniel Weil

Reputation: 1

In addition to Ignacio Soler's response, if the application's frontend uses a nginx to serve static files and uses a "proxy_pass" to access a restricted backend API, then you need to increase "client_max_body_size" configuration inside location used.

enter image description here

Upvotes: 0

Ignacio Soler Garcia
Ignacio Soler Garcia

Reputation: 21855

After several conversations with Microsoft we found that the WAF considers only file attachments if they are sent using multipart/form-data

Multipart example

If you send it this way the WAF will understand it is a file and thus will apply the limits configured for files instead than for bodies.

There is no other way to send files supported by the WAF for now.

Upvotes: 0

Related Questions