Rudloff / alltube

Web GUI for youtube-dl
GNU General Public License v3.0
2.96k stars 582 forks source link

Provide support for serving via reverse proxy with basePath/subfolder #306

Closed bellington3 closed 3 years ago

bellington3 commented 3 years ago

NginX basepath sample (alltube container is listening on localhost:5001):

# Alltube
location ~ ^(/alltube(^/)?)$ {
    return 301 /alltube/;
}

location ~ ^/alltube.*\.(css|png|jpg|ttf)$ 
    rewrite /alltube/(.*) /$1 break;
    proxy_pass http://localhost:5001;
    proxy_set_header Host $host;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $remote_addr
}

location /alltube {
    proxy_pass http://localhost:5001;

    proxy_set_header Host $host;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $remote_addr;
}

Please not that I am not great at PHP nor did executing the tests work for me. But this solution makes it work for me.

Rudloff commented 3 years ago

Thanks for the contribution! Could you please split the new config options in seperate pull requests, in order to make this easier to review?

bellington3 commented 3 years ago

Done, see PR309, PR310 & PR311

// had some git troubles