Welcome! Log In Create A New Profile

Advanced

Re: Help noob with redirection

--[ UxBoD ]--
June 09, 2010 08:22AM
----- Original Message -----
> On Wed, Jun 09, 2010 at 01:05:56PM +0100, --[ UxBoD ]-- wrote:
>
> > ----- Original Message -----
> > > On Wed, Jun 09, 2010 at 12:50:30PM +0100, --[ UxBoD ]-- wrote:
> > >
> > > > Hi,
> > > >
> > > > I have installed my first NGINX proxy and having a real problem
> > > > with
> > > > redirects. As a example I have published externally:
> > > >
> > > > https://pm.domain.com/client1
> > > > https://pm.domain.com/client2
> > > >
> > > > which should then redirect to the clustered back-end servers
> > > > which are named pm01.domain.com etc. What is happening is that
> > > > when I try
> > > > in the URL it comes back with the correct content but the URL in
> > > > the browser shows the back-end server named; so how do I get it
> > > > to be
> > > > the externally published name ?
> > > >
> > > > Config
> > > > ------ server {
> > > > listen 443;
> > > > server_name pm.domain.com;
> > > >
> > > > ssl on;
> > > > ssl_certificate /etc/pki/tls/certs/proxy01c.pem;
> > > > ssl_certificate_key /etc/pki/tls/private/proxy01k.pem;
> > > >
> > > > ssl_session_timeout 5m;
> > > >
> > > > ssl_protocols SSLv2 SSLv3 TLSv1;
> > > > ssl_ciphers
> > > > ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
> > > > ssl_prefer_server_ciphers on;
> > > >
> > > > access_log /var/log/nginx/pm.domain.com-access.log main;
> > > > error_log /var/log/nginx/pm.domain.com-error.log info;
> > > >
> > > > gzip on;
> > > > gzip_http_version 1.0;
> > > > gzip_comp_level 2;
> > > > gzip_proxied any;
> > > > gzip_types text/plain text/html text/css
> > > > application/x-javascript text/xml application/xml
> > > > application/xml+rss text/javascript;
> > > >
> > > > upstream projectmanagement {
> > > > server pm01.domain.com:443;
> > > > server pm02.domain.com:443;
> > > > }
> > > >
> > > > location / {
> > > > proxy_pass https://projectmanagement;
> > > > proxy_redirect on;
> > >
> > > - proxy_redirect on;
> > > + proxy_redirect default;
> > >
> > > > proxy_set_header Host $host;
> > > > proxy_set_header X-Real-IP $remote_addr;
> > > > proxy_set_header X-Forwarded-For
> > > > $proxy_add_x_forwarded_for;
> > > >
> > > > client_max_body_size 10m;
> > > > client_body_buffer_size 128k;
> > > > }
> > > > }
> > >
> > >
> > Igor,
> >
> > I have switched it from on too default but after restarting NGINX I
> > get the same result ?
>
> Sorry, try the following proxy_redirects:
>
> proxy_redirect https://pm01.domain.com/ /;
> proxy_redirect https://pm02.domain.com/ /;
>
>
Igor, that works now using the above syntax :) A question though is there anyway to tell NGINX to redirect based on the proxied hostname ? If we had pm01 ... 100 then I would need to add 100 proxy_redirect statements or can it be done with a clever single line ?
--
Thanks, Phil

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

Help noob with redirection

--[ UxBoD ]-- June 09, 2010 07:54AM

Re: Help noob with redirection

Igor Sysoev June 09, 2010 08:06AM

Re: Help noob with redirection

--[ UxBoD ]-- June 09, 2010 08:10AM

Re: Help noob with redirection

Igor Sysoev June 09, 2010 08:16AM

Re: Help noob with redirection

--[ UxBoD ]-- June 09, 2010 08:22AM

Re: Help noob with redirection

Igor Sysoev June 09, 2010 08:30AM

Re: Help noob with redirection

--[ UxBoD ]-- June 09, 2010 08:36AM

Re: Help noob with redirection

Igor Sysoev June 09, 2010 08:36AM

Re: Help noob with redirection

--[ UxBoD ]-- June 09, 2010 08:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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