Welcome! Log In Create A New Profile

Advanced

Re: support http and https on the same port

Frank Liu
July 25, 2018 04:36PM
In the current setup, I have
location / {
...
bunch of stuff
...
proxy_pass http://upstream.server;
}

Instead of duplicating the whole location block, can we do something like
location @http | / {
...
bunch of stuff
...
proxy_pass http://upstream.server;

}


On Wed, Jul 25, 2018 at 1:23 PM, Maxim Dounin <mdounin@mdounin.ru> wrote:

> Hello!
>
> On Wed, Jul 25, 2018 at 11:37:20AM -0700, Frank Liu wrote:
>
> > I tried:
> >
> > error_page 497 $request_uri;
> >
> > It is kind of working, and I get the correct content/code back, but the
> > response header is still has 400:
> >
> > HTTP/1.1 400 Bad Request
> >
> > My use case has nginx as a reverse proxy, and the real response code from
> > upstream is dropped though the response body and other headers are
> retained.
> >
> > I also tried:
> > error_page 497 =200 $request_uri;
> > and now I get:
> > HTTP/1.1 200 OK
> > instead of real response code from upstream.
>
> Try this instead:
>
> error_page 497 = @http;
>
> location @http {
> proxy_pass http://upstream.server;
> }
>
> But, as previously said, it might not be a good idea to actually
> configure things that way. Rather, 497 can and should be used to
> return a proper error and/or redirection to the correct address
> with the protocol properly specified.
>
> --
> Maxim Dounin
> http://mdounin.ru/
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

support http and https on the same port

Frank Liu July 25, 2018 10:48AM

Re: support http and https on the same port

Maxim Dounin July 25, 2018 11:16AM

Re: support http and https on the same port

Frank Liu July 25, 2018 12:18PM

Re: support http and https on the same port

Frank Liu July 25, 2018 01:28PM

Re: support http and https on the same port

Frank Liu July 25, 2018 02:40PM

Re: support http and https on the same port

Maxim Dounin July 25, 2018 04:24PM

Re: support http and https on the same port

Frank Liu July 25, 2018 04:36PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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