Welcome! Log In Create A New Profile

Advanced

Make relative paths in proxy go to the right server

May 24, 2022 01:25AM
I am a total newbie to this and I don't even know if what I want to do is possible.

I have a web server that locally serves some of the files but in one case needs to pass the web requests on to another server.

For example: "https://myserver.com/weather" needs to be handled locally, but "https://myserver.com/whatever" needs to go to a different server on the network. To do this I have:

location /whatever {
proxy_pass http://10.12.45.12:1234/;
}

This works OK but the pages served by the other server have relative paths to files that are relative to THAT server. The user's browser converts the relative paths from "other_base/file_path.css" to "https://myserver.com/other_base/file_path.css".

I could add another 'location' entry to my configuration for "/other_base" but there is no guarantee that the 'other_base" name will always be the same.

What do I need to put in the Nginx configuration so that the files relative to the other server are correctly redirected (e.g. https://myserve.com/whatever/other_base/file_path.css")

Susan
Subject Author Posted

Make relative paths in proxy go to the right server

AussieSusan May 24, 2022 01:25AM

Re: Make relative paths in proxy go to the right server

Francis Daly May 25, 2022 08:40AM

Re: Make relative paths in proxy go to the right server

AussieSusan May 29, 2022 01:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 231
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready