Welcome! Log In Create A New Profile

Advanced

Nginx does not honor X-Forwarded-Proto ?

Posted by akb 
akb
Nginx does not honor X-Forwarded-Proto ?
September 26, 2015 04:38PM
Hi,

People generally use Nginx as front-end for Apache but my setup is opposite for a specific need:

Client <--------------http/https-------------------> Apache <--------------http-------------------> Nginx

Back-end Nginx gets all requests in plain http and its config is simple:

server {
listen 80;
server_name domain.com;
root /var/www/domain.com;
}

When the client connects using https, Apache is configured to send a X-Forwarded-Proto "https" to Nginx. Now the problem is:

when a ssl URL without a trailing slash is requested:

https://domain.com

Nginx sends the redirect to plain http version with the trailing slash.

http://domain.com/

Shouldn't nginx look at the X-Forwarded-Proto value and redirect appropriately (http to http & https to https)? Read dozens of articles on web in order to seek a proper solution for this but to no avail. I will be really glad if anyone can please help me on this.

Thanks in advance.

-akb
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 219
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready