Welcome! Log In Create A New Profile

Advanced

Nginx Reverse Proxy Lowercase URL and some exceptions to the URL

October 03, 2019 11:36AM
I have the following server configuration. I have two problems that I would appreciate if someone can tell me what I am doing wrong:

1- this location is not respected since the configuration lowercases all uris without respecting these locations. Please note that api, contentAssets, categoryServlet are paths, not directories or folders.

location ~ ^/(api|contentAsset|categoriesServlet|DotAjaxDirector|html|dwr|dA)/{}


2. It seems that if I am in a reverse proxy I have to input the proxy definition in every location because otherwise it does not work. Is the a more practical way to do this?


Thank you for all your help!

Lex

Note: I have changed the proxy IP address and port for x and Is.





server {

listen 80;

server_name example.com;
##Trailing Slash in URLContent
## It doest not work on http://example.com/real-estate/cccc/
#rewrite ^/(.*)/(.*)/$ /$1/$2 permanent;

# matches any query beginning with /contentAsset or dA/ and halts searching,
# so regular expressions will not be checked.
location ~ ^/(api|contentAsset|categoriesServlet|dotAdmin|DotAjaxDirector|html|dwr|dA)/ {

proxy_pass http://xxx.xx.xx.xxx:IIII;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_redirect off;

}
## IT MUST BE FIRST TO LOWERCASE THE URI FIRST
## IF IT HAS UPPERCASE CHARACTERS
location ~ [A-Z] {
return 301 $scheme://$host$my_uri_to_lowercase;


proxy_pass http://xxx.xx.xx.xxx:IIII;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_redirect off;

}

## IT MUST BE FIRST TO LOWERCASE THE URI FIRST
## IF IT HAS UPPERCASE CHARACTERS
location ~ [A-Z] {
return 301 $scheme://$host$my_uri_to_lowercase;

}
location / {
proxy_pass http://xxx.xx.xx.xxx:IIII;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_redirect off;

}


}
Subject Author Posted

Nginx Reverse Proxy Lowercase URL and some exceptions to the URL

Alex Med October 03, 2019 11:36AM

Re: Nginx Reverse Proxy Lowercase URL and some exceptions to the URL

Francis Daly October 03, 2019 11:56AM

Re: Nginx Reverse Proxy Lowercase URL and some exceptions to the URL

Alex Med October 03, 2019 12:21PM

Re: Nginx Reverse Proxy Lowercase URL and some exceptions to the URL

Alex Med October 03, 2019 01:03PM

Re: Nginx Reverse Proxy Lowercase URL and some exceptions to the URL

Francis Daly October 03, 2019 01:38PM

Re: Nginx Reverse Proxy Lowercase URL and some exceptions to the URL

Francis Daly October 03, 2019 03:06PM

Re: Nginx Reverse Proxy Lowercase URL and some exceptions to the URL

Alex Med October 04, 2019 03:36PM

Re: Nginx Reverse Proxy Lowercase URL and some exceptions to the URL

Francis Daly October 04, 2019 04:52PM

Re: Nginx Reverse Proxy Lowercase URL and some exceptions to the URL

Alex Med October 05, 2019 12:41PM

Re: Nginx Reverse Proxy Lowercase URL and some exceptions to the URL

Alex Med October 05, 2019 12:50PM

Re: Nginx Reverse Proxy Lowercase URL and some exceptions to the URL

Francis Daly October 06, 2019 07:16AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 271
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready