Welcome! Log In Create A New Profile

Advanced

Re: proxy_set_header host

Igor Sysoev
December 02, 2009 02:52PM
On Wed, Dec 02, 2009 at 08:28:58PM +0100, Francisco Treacy wrote:

> Okay, I found out (after hours of banging my head).
>
> Apparently I was doing something wrong with Host or $host, it was
> redirecting to /app, quite misleading.
>
> location / {
> proxy_set_header ServerName $server_name;
> proxy_pass http://localhost:9090/app/;
> }
>
> I ended up using $server_name (somehow I didn't figure out before this
> is what I wanted :/ ), also changing the header name... and it works!

There is no "ServerName" header. Probably, you need just

location / {
proxy_pass http://localhost:9090/app/;
}

> Francisco Treacy wrote:
> > I am having quite some trouble with something that should be pretty
> > straightforward.
> >
> > I have an app deployed at http://localhost:9090/app/ , and need to
> > access it via http://subdomain.domain.com.
> >
> > Thus I configured the following, which works fine:
> >
> > location / {
> > proxy_pass http://localhost:9090/app/;
> > }
> >
> > However now I need to access in my code the "subdomain.domain.com"
> > variable. I thought passing it through an HTTP header:
> >
> > location / {
> > proxy_set_header Host $host;
> > proxy_redirect false;
> > proxy_pass http://localhost:9090/app/;
> > }
> >
> > and I manage to get the header "Host", but its value is
> > "localhost:9090". Also tried with $proxy_host.
> >
> > How can I get the value "subdomain.domain.com" in the Host HTTP header?
> >
> > Thanks,
> >
> > Francisco
>
> --
> Posted via http://www.ruby-forum.com/.
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx

--
Igor Sysoev
http://sysoev.ru/en/

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

proxy_set_header host

Fr Tr December 02, 2009 01:24PM

Re: proxy_set_header host

Francisco Treacy December 02, 2009 02:36PM

Re: proxy_set_header host

Igor Sysoev December 02, 2009 02:52PM

Re: proxy_set_header host

Francisco Treacy December 29, 2009 07:34AM

Re: proxy_set_header host

merlin corey December 29, 2009 04:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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