I have nginx configured to be my externally visible webserver which talks to a backend over HTTP.
The scenario I want to achieve is:
- Client makes HTTP request to nginx which is redirect to the same URL but over HTTPS
- nginx proxies request over HTTP to the backend
- nginx receives response from backend over HTTP.
- nginx passes this back to the client over HTTPS
My current config (where backend is configured correctly) is:
server {
listen 80;
server_name localhost;
location ~ .* {
proxy_pass http://backend;
proxy_redirect http://backend https://$host;
proxy_set_header Host $host;
}
}
My problem is the response to the client (step 4) is sent over HTTP not HTTPS. Any ideas?