https to http error "too many redirects"

jinwon42 nginx-forum at
Fri Mar 20 08:08:19 UTC 2015

Thanks for reply!

But, I still saw error.

400 Bad Request
The plain HTTP request was sent to HTTPS port

this setting is wrong?

    map $request_uri $example_org_preferred_proto {
	default "https";
	~^/mobile/ "http";
	~^/kor/ "http";

    server {
        listen	443 ssl;
	listen	80;

	charset utf-8;

        ssl                  on;
        ssl_certificate      D:/nginx-1.5.2/ssl/cert.pem;
        ssl_certificate_key  D:/nginx-1.5.2/ssl/key.pem;
	ssl_verify_client off;

	if ($scheme != $example_org_preferred_proto) {
		return 301 $example_org_preferred_proto://$server_name:88$request_uri;

        location / {
           proxy_set_header Host                $host;
           proxy_set_header X-Real-IP            $remote_addr;
           proxy_set_header X-Forwarded-Host    $host;
           proxy_set_header X-Forwarded-Server    $host;
           proxy_set_header X-Forwarded-For       
	   proxy_set_header X-Forwarded-Proto 	$scheme;
           proxy_set_header        Host $http_host;
	   proxy_buffering off;
           proxy_connect_timeout 60;
           proxy_read_timeout 60;
           proxy_pass   http://wwwaaaacom;
	   proxy_ssl_session_reuse off;

Posted at Nginx Forum:,257458,257467#msg-257467

More information about the nginx mailing list