I am trying to mirror/reverse-proxy the package server pkgs.tailscale.com
because that server is blocked at some locations.
For some reason I can easily mirror the regular tailscale.com website with this nginx config:
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name regularsite.myserver.net;
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
ssl_trusted_certificate /path/to/chain.pem;
ssl_dhparam /path/to/dhparam.pem;
location / {
proxy_pass https://tailscale.com;
# proxy_set_header Host $host; #This line cannot be used
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
But when I try to mirror the packages site in a similar way I just get a 502 error when going there :
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name pkgs.myserver.net;
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
ssl_trusted_certificate /path/to/chain.pem;
ssl_dhparam /path/to/dhparam.pem;
location / {
proxy_pass https://pkgs.tailscale.com;
# proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
I tried a lot of different nginx settings but can’t get it work.
Anyone that can knows what the problem is and how to fix it ? Preferably with Nginx but Apache or something else would also be fine.
Please try your answer first before answering, I already tried a lot of different configurations that (in theory) should work fine but didn’t.
Just to be clear:
- My server with nginx is able to connect to pkgs.tailscale.com over https, I checked it that with curl.
- It’s not really called myserver.net, that’s just an example…