Welcome! Log In Create A New Profile

Advanced

Re: port_in_redirect not working?

Maxim Dounin
November 07, 2011 12:28PM
Hello!

On Mon, Nov 07, 2011 at 11:17:28AM -0500, olan wrote:

> Hi all,
>
> I posted this question on SO but haven't received much attention, so I
> figured here would be better.
>
> Basically I am attempting to run varnish on port 80 and my nginx server
> on 8080, however any request to 80 redirects and appends the port to the
> URL.
>
> i.e. http://site.com/ -> http://site.com:8080/
>
> From everything I've read it seems that 'port_in_redirect off' should
> disable this, however it does not appear to be working. I've used a
> workaround for php by using "fastcgi_param SERVER_PORT 80;", which
> works, but requests to my "location /" are getting the port appended.
>
> My server setup is:
>
> server {
> listen 8080 default;
> server_name "" xxx.xxx.xxx.xxx; #just using IP here (no domain
> yet)
>
> port_in_redirect off;
> server_name_in_redirect off;
>
> access_log /var/log/nginx/localhost.access.log;
>
>
> location / {
> root /var/www/site/html/;
> index index index.php;
> try_files $uri/ $uri /index.php?q=$uri&$args;
> }
> }
> upstream backend {
> server 127.0.0.1:9000;
> }
>
> I have tried port_in_redirect in both the "location /" and the server
> blocks, but neither works.
>
> Can anyone shed any light on this problem? I'm currently using nginx
> v1.0.9 on a ubuntu server.
>
> [Link to SO question (full .conf there):
> http://stackoverflow.com/questions/8026763/nginx-port-in-redirect-not-working]

The "port_in_redirect" directive only alters behaviour of nginx
itself (for trailing slash redirects, rewrites and so on), and
it's expected that it does nothing for redirects returned by php.

With "fastcgi_param SERVER_PORT 80;" php should be fine, and I
suspect that problem you see is actually related to your browser
(or varnish) cache sitting here from previous configurations.

If clearing cache doesn't help, please provide debug log (see
http://wiki.nginx.org/Debugging), it will show what goes on here.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

port_in_redirect not working?

olan November 07, 2011 09:51AM

Re: port_in_redirect not working?

Maxim Dounin November 07, 2011 12:28PM

Re: port_in_redirect not working?

olan November 07, 2011 01:25PM

Re: port_in_redirect not working?

Nginx User November 07, 2011 02:46PM

Re: port_in_redirect not working?

Nginx User November 07, 2011 02:48PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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