# Config file order

**URL:** <https://www.ruby-forum.com/t/config-file-order/216633>\
**Category:** NGINX\
**Created:** [February 9, 2012, 6:49pm UTC](https://www.ruby-forum.com/t/config-file-order/216633 "2012-02-09T18:49:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [February 9, 2012, 6:49pm UTC](https://www.ruby-forum.com/t/config-file-order/216633/1 "2012-02-09T18:49:34Z")

</div>

I know the server order in the config file makes a difference. Does the  
order of the statements inside the location tags make a difference?

Do I need to set the headers before doing a proxy\_pass or does it  
matter?

Thanks.

---

<div class="post-metadata">

**Author:** ![Bai\_Shen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@Bai\_Shen](https://www.ruby-forum.com/u/Bai_Shen)\
**Post date:** [February 9, 2012, 6:59pm UTC](https://www.ruby-forum.com/t/config-file-order/216633/2 "2012-02-09T18:59:33Z")

</div>

Hello!

On Thu, Feb 09, 2012 at 12:49:16PM -0500, Bai Shen wrote:

> I know the server order in the config file makes a difference. Does the  
> order of the statements inside the location tags make a difference?
> 
> Do I need to set the headers before doing a proxy\_pass or does it matter?

In most cases order doesn’t matter. There are some special cases  
though, most notably regexp locations and rewrite module  
directives, where order matters. In such special cases order of  
processing is usually explicitly documented.

As for proxy\_pass and proxy\_set\_header - order doesn’t matter.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Bai\_Shen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@Bai\_Shen](https://www.ruby-forum.com/u/Bai_Shen)\
**Post date:** [February 9, 2012, 7:07pm UTC](https://www.ruby-forum.com/t/config-file-order/216633/3 "2012-02-09T19:07:38Z")

</div>

That’s what I thought, but I wasn’t sure. I’m trying to get the remote  
IP  
to show up in my web server logs and wanted to make sure nginx was  
sending  
it.
