Hello, I have a setup for my Nginx reverse proxy to reverse proxy http://localhost:8080 from my main domain, with SSL setup using a Cloudflare Origin certificate and proxying with Cloudflare. When I try to change http://localhost:8080 to https://<another site>, Cloudflare returns 502 Bad Gateway.
Working code:
server {
location / {
proxy_pass http://localhost:8080
proxy_pass_request_headers on;
proxy_redirect off;
proxy_buffering off;
proxy_buffer_size 16k;
proxy_busy_buffers_size 24k;
proxy_buffers 64 4k;
}
listen 443 ssl;
ssl_certificate /etc/certs/cert.pem;
ssl_certificate_key /etc/certs/key.pem;
}
Not working code:
server {
location / {
proxy_pass https://<website>.com
proxy_set_header Host <website>.com;
proxy_pass_request_headers on;
proxy_redirect off;
proxy_buffering off;
proxy_buffer_size 16k;
proxy_busy_buffers_size 24k;
proxy_buffers 64 4k;
}
listen 443 ssl;
ssl_certificate /etc/certs/cert.pem;
ssl_certificate_key /etc/certs/key.pem;
}
Is there something special I have to add for https, or for non-local requests? Thanks!
Attachments:
open |
download -
image_2024-07-01_133509890.png
(43.7 KB)