我们有以下安全网站。 如果用户打开http://name.tld ,他应该被redirect到https://name.tld 。 我们最初搞砸了安全站点域的顺序,所以http://name.tld被redirect到了https://sub.name.tld而不是http://name.tld 。
我们改变了服务器名称的顺序,但是所有的浏览器都caching了redirect。 如果我手动禁用caching的铬,它的作品。 但其他任何人都需要这样做。
我们如何强制所有的浏览器清除他们的redirectcaching(首选)或禁用告诉他们不cachingredirect? 有我们可以发送的标题吗?
这是我们的网站:
server { listen 80; server_name name.tld sub.name.tld localhost sub.localhost; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name name.tld sub.name.tld localhost sub.localhost; ssl_certificate /etc/ssl/certs/fullchain.pem; ssl_certificate_key /etc/ssl/private/privkey.pem; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!MD5; # required for large JSON files client_max_body_size 50m; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / { root /usr/share/nginx/html/name.tld; index index.html index.htm; } location /api { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://our-api:5000/api; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }
编辑:与redirect的实际连接问题是CORS。 对API的请求失败,因为请求将来自不同的域。
针对我们的解决scheme(特定于我们的情况)是为来自https://sub.name.tld请求启用CORS(请参阅上面的编辑)。 受影响的人至less在https://sub.name.tld下有一个正在工作的网站