# Client\_max\_body\_size for a location {} Possible?

**URL:** <https://www.ruby-forum.com/t/client-max-body-size-for-a-location-possible/220309>\
**Category:** NGINX\
**Created:** [June 5, 2012, 7:02pm UTC](https://www.ruby-forum.com/t/client-max-body-size-for-a-location-possible/220309 "2012-06-05T19:02:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [June 5, 2012, 7:02pm UTC](https://www.ruby-forum.com/t/client-max-body-size-for-a-location-possible/220309/1 "2012-06-05T19:02:08Z")

</div>

Is it possible to specify a client\_max\_body\_size and  
client\_body\_buffer\_size specifically for a location? If so how?

I need to allow higher buffers for a section that hosts an application.

Thanks

Joseph

---

<div class="post-metadata">

**Author:** ![jchengj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d78d45/32.png) [@jchengj](https://www.ruby-forum.com/u/jchengj)\
**Post date:** [June 5, 2012, 7:31pm UTC](https://www.ruby-forum.com/t/client-max-body-size-for-a-location-possible/220309/2 "2012-06-05T19:31:59Z")

</div>

Answering myself partially

location /wordpress/wp-admin { client\_max\_body\_size 1m; } \<-- does  
that apply for evert sub directory such as /wordpress/wp-admin/dir1  
/wordpress/wp-admin/dir2/app.php etc

Joseph

From: removed\_email\_address@domain.invalid  
To: removed\_email\_address@domain.invalid  
Subject: client\_max\_body\_size for a location {} ? Possible?  
Date: Tue, 5 Jun 2012 17:01:34 +0000

Is it possible to specify a client\_max\_body\_size and  
client\_body\_buffer\_size specifically for a location? If so how?

I need to allow higher buffers for a section that hosts an application.

Thanks

Joseph

---

<div class="post-metadata">

**Author:** ![jchengj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d78d45/32.png) [@jchengj](https://www.ruby-forum.com/u/jchengj)\
**Post date:** [June 5, 2012, 8:41pm UTC](https://www.ruby-forum.com/t/client-max-body-size-for-a-location-possible/220309/3 "2012-06-05T20:41:35Z")

</div>

Hello!

On Tue, Jun 05, 2012 at 05:31:25PM +0000, Joseph C. wrote:

> Answering myself partially
> 
> location /wordpress/wp-admin { client\_max\_body\_size 1m; } ← does that  
> apply for evert sub directory such as /wordpress/wp-admin/dir1  
> /wordpress/wp-admin/dir2/app.php etc

See here for details explanation on how locations work:

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#location)**
>
> This directive appeared in version 1.11.8.

And here for an answer to your original question:

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size)**
>
> This directive appeared in version 1.11.8.

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size)**
>
> This directive appeared in version 1.11.8.

The “context” in the directive description gives a list of places  
where the directive is allowed.

Maxim D.

---

<div class="post-metadata">

**Author:** ![jchengj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d78d45/32.png) [@jchengj](https://www.ruby-forum.com/u/jchengj)\
**Post date:** [June 5, 2012, 9:33pm UTC](https://www.ruby-forum.com/t/client-max-body-size-for-a-location-possible/220309/4 "2012-06-05T21:33:02Z")

</div>

Hello Matt,

Thank you very much. Is there anyway to match this location ONLY for a  
specific IP?

```
    location /wordpress {
                      client_body_buffer_size 1M;
                          client_max_body_size 2M;
                       proxy_pass http://backend1;
                     }

```

In other words I only one IP 1.1.1.1 to be able to use those special  
buffers for that URL… everybody else should use the buffers stated at  
the httpd section.

Regards,  
Joseph
