Remove serverAddress from Feeds and FeedEpisodes URLs

This commit is contained in:
mikiher 2024-12-07 19:27:37 +02:00
parent 3b4a5b8785
commit 9b8e059efe
10 changed files with 331 additions and 47 deletions

View file

@ -253,6 +253,10 @@ class Server {
// if RouterBasePath is set, modify all requests to include the base path
if (global.RouterBasePath) {
app.use((req, res, next) => {
const host = req.get('host')
const protocol = req.secure || req.get('x-forwarded-proto') === 'https' ? 'https' : 'http'
const prefix = req.url.startsWith(global.RouterBasePath) ? global.RouterBasePath : ''
req.originalHostPrefix = `${protocol}://${host}${prefix}`
if (!req.url.startsWith(global.RouterBasePath)) {
req.url = `${global.RouterBasePath}${req.url}`
}