http->https redirection on the same port

Igor Sysoev is at
Tue Jun 17 20:11:29 MSD 2008

On Tue, Jun 17, 2008 at 08:55:35AM -0700, Michael Nachbaur wrote:

> Hi, I'm currently migrating from Apache to lighttpd, but ran into a  
> blocker that I can't seem to find my way around.  So I'm looking into  
> using nginx instead, but I wanted to ask if my blocker exists here as  
> well.
> I have a web application running on a high port number.  It needs to  
> be SSL encrypted, but I need to redirect the browser to https:// URLs  
> automatically if they leave it as standard HTTP.  For instance:
> ->
> I can't use different port numbers.  Apache supports this quite well,  
> and while supposedly lighttpd supports this in its most recent  
> version, I've been having some really weird problems I've been  
> tracking down.
> Does anyone know if this is possible with nginx?  I'll make the switch  
> in a second if it is.  Thanks.

         server {
             listen  8000;

             ssl     on;
             #other ssl stuff

             error_page  497$request_uri;


The 497 code means that a usual request was sent to HTTPS.

BTW, how had you implemented this in Apache ?

Igor Sysoev

More information about the nginx mailing list