Welcome! Log In Create A New Profile

Advanced

Re: http to https rewrite, non-standard port?

December 06, 2010 07:04AM
On Mon, Dec 06, 2010 at 11:47:10AM +0000, John Moore wrote:

> I want to rewrite all http requests for a host to https, on port 9443
> instead of the the standard 443. So I have this in my nginx.conf:
>
> server {
> server_name www.domain.com;
> listen 80;
> location / {
> rewrite ^(.*)$ https://$host:9443$1 permanent;
> }
> }
>
> server {
> server_name www.domain.com;
> listen 9443;
> location / {
> #etc...
> }
> }
>
>
> And as long as I use 'http://www.domain.com', the rewrite works fine.
> But some URLS are coming back now as 'http://www.domain.com:9443' and
> I'm running into the 400 error"The plain HTTP request was sent to HTTPS
> port", for obvious reasons. So how do I get it to rewrite 'http://' to
> 'https://' as well, which is what I presume I need to do?

error_page 497 https://$host:9443$request_uri;


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

http to https rewrite, non-standard port?

J2R December 06, 2010 06:52AM

Re: http to https rewrite, non-standard port?

Igor Sysoev December 06, 2010 07:04AM

Re: http to https rewrite, non-standard port?

Quincy August 03, 2011 04:20AM

Re: http to https rewrite, non-standard port?

cyberjar09 January 07, 2013 05:01AM

Re: http to https rewrite, non-standard port?

Maxim Dounin August 03, 2011 04:44AM

Re: http to https rewrite, non-standard port?

Igor Sysoev August 03, 2011 03:10PM

Re: http to https rewrite, non-standard port?

Igor Sysoev August 03, 2011 03:06PM

Re: http to https rewrite, non-standard port?

Quincy August 04, 2011 05:04AM

Re: http to https rewrite, non-standard port?

cyberjar09 January 07, 2013 04:16AM

Re: http to https rewrite, non-standard port?

cyberjar09 January 07, 2013 04:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 102
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready