I am trying to make a proxy which redirects www.example.com/api/... to
https://0.0.0.0:8443/api/
I have tried this:
server {
server_name example.com www.example.com;
listen 443 ssl http2 default_server;
add_header Strict-Transport-Security "max-age=31536000" always;
ssl_certificate /etc/nginx/ssl/ssl-bundle.crt;
ssl_certificate_key /etc/nginx/ssl/example_com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
error_page 404 = @foobar;
location @foobar {
rewrite .* / permanent;
}
location /api/ {
proxy_pass https://0.0.0.0:8443/api/;
}
location / {
root /usr/share/nginx/html;
index index.html;
}
}
The result from nginx is 502 Bad Gateway any help is much appreciated.