How do I redirect HTTPS to HTTP on NGINX?

Viewed 129297

Is there a way to redirect HTTPS requests to HTTP by adding a rule in the domain's vhost file?

8 Answers

Not a proper solution, but I was able to solve my use case by using Cloudflare, which handled the SSL for me transparently.

server{
  listen 80;
  listen [::]:80;

  server_name mywebsite.com ;
  return 301 https://$host$request_uri;
}

After inserting this code, all traffic for the HTTP default server redirects to HTTPS.

Related