I'm having some difficulty configuring nginx reverse proxy and i think some kind of re-write rule is needed.
location /kodi {
rewrite ^/kodi$ https://home.example.com/kodi/ permanent;
rewrite ^/kodi/(.*) /$1 break;
proxy_redirect http://localhost:5555 /kodi/;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://localhost:5555;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /image
{
proxy_pass http://localhost:5555;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /vfs
{
proxy_pass http://localhost:5555;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
The website has links of the form
https://home.example.com/kodi/vfs/%2fmedia%2fVirtual%2fVideos%2fTV%2fexamplevideo.mp4
but this url works:
https://home.example.com/vfs/%2fmedia%2fVirtual%2fVideos%2fTV%2fexamplevideo.mp4
the correct internal url is
http://localhost:5555/vfs/%2fmedia%2fVirtual%2fVideos%2fTV%2fexamplevideo.mp4
So I think what I'm asking is how can I redirect anything with links that start https://home.example.com/kodi/vfs to http://localhost:5555/vfs
?
location /kodi {
rewrite ^/kodi$ https://home.example.com/kodi/ permanent;
rewrite ^/kodi/(.*) /$1 break;
proxy_redirect http://localhost:5555 /kodi/;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://localhost:5555;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /image
{
proxy_pass http://localhost:5555;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /vfs
{
proxy_pass http://localhost:5555;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
The website has links of the form
https://home.example.com/kodi/vfs/%2fmedia%2fVirtual%2fVideos%2fTV%2fexamplevideo.mp4
but this url works:
https://home.example.com/vfs/%2fmedia%2fVirtual%2fVideos%2fTV%2fexamplevideo.mp4
the correct internal url is
http://localhost:5555/vfs/%2fmedia%2fVirtual%2fVideos%2fTV%2fexamplevideo.mp4
So I think what I'm asking is how can I redirect anything with links that start https://home.example.com/kodi/vfs to http://localhost:5555/vfs
?