<p dir="ltr">Correct, you give the HSTS header on the SSL/TLS port. So if *any* connection in the past has gone to the SSL/TLS port, the browser is forced to use https:// for any future connection. You should set it to 1 for a while and then disable it.</p>
<div class="gmail_quote">On Mar 20, 2015 9:48 AM, "jinwon42" <<a href="mailto:nginx-forum@nginx.us">nginx-forum@nginx.us</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sorry.<br>
<br>
80 port is right.<br>
<br>
<br>
if ($scheme != $example_org_preferred_proto) {<br>
return 301 $example_org_preferred_proto://$server_name$request_uri;<br>
}<br>
<br>
<br>
Still saw error. "ERR_TOO_MANY_REDIRECTS"<br>
<br>
<br>
<br>
<br>
-------------------------------------------------------<br>
<br>
map $request_uri $example_org_preferred_proto {<br>
default "https";<br>
~^/mobile/PayOnlyResult.do "http";<br>
~^/kor/tel.do "http";<br>
}<br>
<br>
server {<br>
listen 443 ssl;<br>
listen 80;<br>
server_name <a href="http://www.aaaa.com" target="_blank">www.aaaa.com</a>;<br>
<br>
charset utf-8;<br>
<br>
#ssl on;<br>
ssl_certificate D:/nginx-1.7.10/ssl/cert.pem;<br>
ssl_certificate_key D:/nginx-1.7.10/ssl/key.pem;<br>
ssl_verify_client off;<br>
<br>
ssl_session_timeout 5m;<br>
<br>
ssl_protocols SSLv3 TLSv1;<br>
ssl_ciphers AES256-SHA:HIGH:!EXPORT:!eNULL:!ADH:RC4+RSA;<br>
ssl_prefer_server_ciphers on;<br>
<br>
# HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)<br>
add_header Strict-Transport-Security max-age=15768000;<br>
<br>
error_page 400 /error/error.html;<br>
error_page 403 /error/error.html;<br>
error_page 404 /error/error.html;<br>
<br>
if ($scheme != $example_org_preferred_proto) {<br>
return 301 $example_org_preferred_proto://$server_name$request_uri;<br>
}<br>
<br>
location / {<br>
proxy_set_header Host $host;<br>
proxy_set_header X-Real-IP $remote_addr;<br>
proxy_set_header X-Forwarded-Host $host;<br>
proxy_set_header X-Forwarded-Server $host;<br>
proxy_set_header X-Forwarded-For<br>
$proxy_add_x_forwarded_for;<br>
proxy_set_header X-Forwarded-Proto $scheme;<br>
proxy_set_header Host $http_host;<br>
proxy_buffering off;<br>
proxy_connect_timeout 60;<br>
proxy_read_timeout 60;<br>
proxy_pass <a href="http://wwwaaaacom" target="_blank">http://wwwaaaacom</a>;<br>
proxy_ssl_session_reuse off;<br>
}<br>
}<br>
<br>
Posted at Nginx Forum: <a href="http://forum.nginx.org/read.php?2,257458,257469#msg-257469" target="_blank">http://forum.nginx.org/read.php?2,257458,257469#msg-257469</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div>