0

I'm trying to serve 2 different websites under the same subdomain depending on the location.

Using the GUI from Nginx Proxy Manager Docker container I've managed to set up the initial domain https://foo.bar.baz that redirects to another Docker container http://dockercontainer:port.

By editing the "Custom locations" tab I've been able to set up a redirect from https://foo.bar.baz/test/ to http://dockercontainer:anotherport/

However, the website isn't loading any of the resources since it doesn't seem to be redirecting the resources requests and I'm getting 404'd for requests such as https://foo.bar.baz/test/styles.css.

Current .conf relevant lines:

location /test/ {
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-Scheme $scheme;
  proxy_set_header X-Forwarded-Proto  $scheme;
  proxy_set_header X-Forwarded-For    $remote_addr;
  proxy_set_header X-Real-IP          $remote_addr;
  proxy_pass       http://foo.bar.baz:4123/;

<snip>

  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection $http_connection;
  proxy_http_version 1.1;

}

location / {
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection $http_connection;
  proxy_http_version 1.1;

  # Proxy!
  include conf.d/include/proxy.conf;
}

I've tried searching around for different solutions but some of them weren't relevant or similar to this case, and others were based on modifying the source code of the website, which I'm not able to do.

Shadark
  • 101
  • 1
  • what do you get when you access http://foo.bar.baz:4123/style.css ? – faizan Jun 19 '23 at 08:02
  • Where are your log entries? – symcbean Jun 19 '23 at 09:27
  • @faizan I can't get a connection when I access that URL. I'm guessing that's because "base" foo.bar.baz redirects to dockercontainer:8080 (inside the custom network in Docker) but foo.bar.baz/test would've redirected to dockercontainer:4123 , different ports. – Shadark Jun 20 '23 at 14:56
  • @symcbean Where would I be able to get logs about what's happening? Didn't knew that there were logs for all requests, that'd be very helpful. – Shadark Jun 20 '23 at 14:57
  • The log locations (and the contents for the access_log) are defined in your nginx config. – symcbean Jun 20 '23 at 15:08

0 Answers0