# Rewrites for sites without SSL on same IP address as those using SSL

**URL:** <https://www.ruby-forum.com/t/rewrites-for-sites-without-ssl-on-same-ip-address-as-those-using-ssl/218701>\
**Category:** NGINX\
**Created:** [April 9, 2012, 3:42pm UTC](https://www.ruby-forum.com/t/rewrites-for-sites-without-ssl-on-same-ip-address-as-those-using-ssl/218701 "2012-04-09T15:42:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurdipe\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b77776/32.png) [@Gurdipe\_D](https://www.ruby-forum.com/u/Gurdipe_D)\
**Post date:** [April 9, 2012, 3:42pm UTC](https://www.ruby-forum.com/t/rewrites-for-sites-without-ssl-on-same-ip-address-as-those-using-ssl/218701/1 "2012-04-09T15:42:29Z")

</div>

I have a few sites on a single IP and a single nginx instance. Some  
domains have SSL certificates (and listen on ports 80 and 443) and some  
don’t (and only listen on port 80).

For those domains that don’t have an SSL certificate, including a server  
block listening on port 443 to rewrite to port 80 does not work. I  
understand this is because the SSL exchange happens prior to the server  
name being inspected.

When browsing over https to one of the sites without an SSL certificate,  
the current behaviour is that a security warning is presented to the  
client that lists the certificate for the default\_server and not the  
appropriate domain.

Is there a way to rewrite https requests to http (for the domains with  
an SSL certificate) while retaining the appropriate domain?

If not, is the best way to resolve this to add an additional IP and use  
one for those sites requiring ports 80 and 443 and another for those  
only using port 80?

Thanks.

Posted at Nginx Forum:

> **[Rewrites for sites without SSL on same IP address as those using SSL](https://forum.nginx.org/read.php?2,225064,225064#msg-225064)**
>
> I have a few sites on a single IP and a single nginx instance. Some domains have SSL certificates (and listen on ports 80 and 443) and some don't (and only listen on port 80). For those domains that don't have an SSL certificate, including a server...

---

<div class="post-metadata">

**Author:** ![auxbuss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e68b1a/32.png) [@auxbuss](https://www.ruby-forum.com/u/auxbuss)\
**Post date:** [April 9, 2012, 3:55pm UTC](https://www.ruby-forum.com/t/rewrites-for-sites-without-ssl-on-same-ip-address-as-those-using-ssl/218701/2 "2012-04-09T15:55:31Z")

</div>

On Mon, Apr 09, 2012 at 09:41:54AM -0400, auxbuss wrote:

> the current behaviour is that a security warning is presented to the  
> client that lists the certificate for the default\_server and not the  
> appropriate domain.
> 
> Is there a way to rewrite https requests to http (for the domains with  
> an SSL certificate) while retaining the appropriate domain?

Do you mean the domains WITHOUT an SSL certificate ?

> If not, is the best way to resolve this to add an additional IP and use  
> one for those sites requiring ports 80 and 443 and another for those  
> only using port 80?

## Yes, in this case Firefox will show

Unable to connect  
Firefox can’t establish a connection to the server at …

---

<div class="post-metadata">

**Author:** ![auxbuss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e68b1a/32.png) [@auxbuss](https://www.ruby-forum.com/u/auxbuss)\
**Post date:** [April 9, 2012, 3:58pm UTC](https://www.ruby-forum.com/t/rewrites-for-sites-without-ssl-on-same-ip-address-as-those-using-ssl/218701/3 "2012-04-09T15:58:40Z")

</div>

Yes, I mean domains without an SSL certificate.

Posted at Nginx Forum:

> **[Re: Rewrites for sites without SSL on same IP address as those using SSL](https://forum.nginx.org/read.php?2,225064,225066#msg-225066)**
>
> I have a few sites on a single IP and a single nginx instance. Some domains have SSL certificates (and listen on ports 80 and 443) and some don't (and only listen on port 80). For those domains that don't have an SSL certificate, including a server...
