I have setup a proxy for a site which works with the following nginx config:

server {
    listen 80;

    server_name proxy.example.com;
    access_log /dev/null;
    error_log  /dev/null;

    location / {
        proxy_pass        http://thepiratebay.se;
        proxy_set_header  X-Real-IP       $remote_addr;

However on this there are also styles loaded from a subdomain (static.thepiratebay.se) which aren't going through my proxy, because it links to the original domain. Is there a way to also let those requests go to my proxy? Do I have to change the contents of the pages when serving it to let them also go through my proxy? If so: how? :) Or is there another (perhaps better) way?


I found a solution by replacing the URLs by doing the following in my config:

sub_filter 'static.thepiratebay.se' 'static.proxy.example.com';
sub_filter_once off;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.