server { listen [::]:80; listen 80; # listen on both hosts server_name couch.silvrtree.co.uk; # and redirect to the https host (declared below) # avoiding http://www -> https://www -> https:// chain. return 301 https://couch.silvrtree.co.uk$request_uri; } server { listen [::]:443 ssl spdy; listen 443 ssl spdy; server_name couch.silvrtree.co.uk; include secure/ssl.conf; location / { proxy_pass https://127.0.0.1:6984; proxy_pass_header Accept; proxy_pass_header Server; keepalive_requests 1000; add_header 'Access-Control-Allow-Origin' '*'; proxy_redirect off; proxy_buffering off; proxy_set_header Host $host; proxy_set_header Authorization ""; # or according to server.ini proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; } }