http to https rewrite, non-standard port?

Igor Sysoev igor at sysoev.ru
Wed Aug 3 19:09:20 UTC 2011


On Wed, Aug 03, 2011 at 12:42:43PM +0400, Maxim Dounin wrote:
> Hello!
> 
> On Wed, Aug 03, 2011 at 04:20:39AM -0400, Quincy wrote:
> 
> > I have the same problem. I can't redirect http to https. Here is my
> > config:
> > 
> > server {
> >   listen 2121;
> >   server_name XXXXX;
> >   ssl on;
> >   ssl_certificate XXt;
> >   ssl_certificate_key XX;
> >   #server_name _;
> >   server_name_in_redirect off;
> >   port_in_redirect off;
> > 
> >   root XXX;
> > 
> >   location / {
> >     index index.php;
> >     error_page 404 = @mediawiki;
> >     error_page 497 = @https;
> 
> Setting "error_page 497" is usesless as nginx won't read and parse 
> http headers for invalid requests.  Move it to server level. 

As to 497 error nginx parses completely request headers, so it knows
$host, $request_uri, $uri, etc. However, nginx throws this code before
it will look up locations.


-- 
Igor Sysoev



More information about the nginx mailing list