I have an edge server in which a varnish and an Nginx are installed on it. I use Nginx as a reverse_proxy for SSL termination for HTTPS traffic and also forwarding HTTP traffic. Both traffics are forwarded to varnish. I have several HTTP and HTTPS sites with valid SSL which are working properly. I have a website with a lot of parked domains which is not in HTTPS. But when I search one of its link in Google, that page is shown in HTTPS and the browser tries to open it in HTTPS so I get HTTPS error!! I also have not created any virtualhost block for that domain in nginx!! I want to know is there any way to redirect a non https website to its http version or more generally redirect all websites with invalid SSL to their HTTP version? If it can be done, should anythings be changed in varnish too?

  • Unfortunately, this will not work as you wish. The SSL warning comes from the browser side. – dkokmadis Aug 24 '17 at 9:10
  • 1
    When connecting to the site with https, the browser first establishes a TLS connection, and for that one needs to have proper certificates in order for the connection to succeed. Only after that one can make HTTP redirects. If it wasn't like this, TLS wouldn't be a secure protocol. – Tero Kilkanen Aug 24 '17 at 9:53
  • Thank you guys. But my problem is something else. I mean I want to redirect all HTTPS to HTTP. I did it in htaccess. But I want to know how to do it in nginx. When I search in google it opens the website in https while it is http originally!! If I add a rewrite rule in htaccess and set my hosts file to backend IP, I can redirect https to http. But I want to do it in Nginx. – Sinai Aug 24 '17 at 11:04

Firstly, if the domains are parked, you won't see that traffic anyway. So there's nothing you can do about it.

Secondly, if your domains -aren't- parked, and you can see the traffic, there are two options:

1: Buy / auth an SSL with someone like letsencrypt or trustico or something, and run the site on https, then redirect to http.

2: head into google webmasters, register the domains with them so that you are the owner. Tell google to reindex the website, and also tell it to remove any https links that it currently has.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.