0

i force visitors to SSL on two ways in my serverblock

        if ($http_x_forwarded_proto = "http") {
     return 301 https://$server_name$request_uri;
    }

and

add_header Strict-Transport-Security "max-age=31536000;includeSubdomains; preload";

My issue now is that some scripts aren't able to connect to ssl, i think they will not react to STS but is it possible to exclude only one folder from the rewrite without further trouble? I would like to exclude website.org/feed

Deex
  • 131
  • 7

2 Answers2

0

Fixed. To exclude files from the Rewrite is pretty easy, instead of the server block, the SSL Rewrite should be in the location Block like

location / {
    if ($http_x_forwarded_proto = "http") {
        return 301 https://$server_name$request_uri;
    }
}

After the exclude

location /feed/ {}
ZimbiX
  • 103
  • 2
Deex
  • 131
  • 7
0

Your sollution is too complex. Just create a simple redirect in your website config:

server {
    listen 80;
    server_name yourwebsite.com;

    return 301 https://yourwebsite.com$request_uri;
}

server {
    listen 443 ssl;
    server_name yourwebsite.com;

    Your...;
    Original...;
    Code...;
    ...;
}
Bert
  • 1,028
  • 1
  • 16
  • 33