Welcome! Log In Create A New Profile

Advanced

Re: Reverse proxy from HTTPS to HTTP from an unknown source location

July 22, 2011 11:32PM
normally, your backend server should do the redirect in a relative URL, unless you really want to redirect to another host. That's something like

sendRedirct("/redirectTo/anotherPath");

In this way, the backend server will send redirect URL with the HOST header specified in the request. In your case, it should be:

Location: http://mybackendserver:8080/redirectTo/anotherPath

If you don't use "proxy_add_header Host xxxx", nginx will the argument specified in "proxy_pass" as the Host to the backend. And in this case, the config:

proxy_redirect default;

Or
proxy_redirect http://mybackendserver:8080/ /;

will automatically handle everything.

If you insist to let the backend server do the FULL URL redirection, you have to manually specify all possible proxy_redirect like this:

proxy_redirect <FULL URL 1> /;
proxy_redirect <FULL URL 2> /;
...

By the way, the first argument of "proxy_redirect" doesn't support var. If you specify a var, nginx doesn't recognize it, and doesn't report an error too. It just considers it as literal.
Subject Author Posted

Reverse proxy from HTTPS to HTTP from an unknown source location

alex.sherwin July 22, 2011 04:43PM

Re: Reverse proxy from HTTPS to HTTP from an unknown source location

speedfirst July 22, 2011 11:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 236
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