Re: support http and https on the same port

2018-07-25 Thread Frank Liu
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, J

Re: support http and https on the same port

2018-07-25 Thread Maxim Dounin
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 pro

Re: support http and https on the same port

2018-07-25 Thread Frank Liu
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 oth

Re: support http and https on the same port

2018-07-25 Thread Frank Liu
I just tried it quickly. nginx gives 400 instead of 497 when I connect as http to a ssl virtual host. server { listen 8443 ssl; server_name localhost; ssl_certificate /opt/nginx/ssl/localhost.crt; ssl_certificate_key /opt/nginx/ssl/localhost.key; ssl_session_cacheshare

Re: support http and https on the same port

2018-07-25 Thread Frank Liu
Thanks Maxim! Is there a way to tell nginx to treat 497 as no error, and continue normal processing? On Wed, Jul 25, 2018 at 8:14 AM, Maxim Dounin wrote: > Hello! > > On Wed, Jul 25, 2018 at 07:46:49AM -0700, Frank Liu wrote: > > > Stream servers can now do ssl and non-ssl on the same port: > >

Re: support http and https on the same port

2018-07-25 Thread Maxim Dounin
Hello! On Wed, Jul 25, 2018 at 07:46:49AM -0700, Frank Liu wrote: > Stream servers can now do ssl and non-ssl on the same port: > https://www.nginx.com/blog/running-non-ssl-protocols-over-ssl-port-nginx-1-15-2/ > > Can this be added to http virtual hosts as well? > If ssl is on a listening port

support http and https on the same port

2018-07-25 Thread Frank Liu
Stream servers can now do ssl and non-ssl on the same port: https://www.nginx.com/blog/running-non-ssl-protocols-over-ssl-port-nginx-1-15-2/ Can this be added to http virtual hosts as well? If ssl is on a listening port and client doesn't send ClientHello, can nginx fallback to use normal http? Ma