support http and https on the same port
Frank Liu
gfrankliu at gmail.com
Wed Jul 25 20:33:09 UTC 2018
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 at 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 at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20180725/6d62d46a/attachment.html>
More information about the nginx
mailing list