1

Let's say I have three applications on my server: node-red (1880), jupyter (8888) and pgadmin (5433)... I can successfully create a localhost proxy pass with them individually as the following:

<VirtualHost *:80>

    ServerName 127.0.0.1
    <Location "/">
        ProxyPass http://127.0.0.1:1880/
        ProxyPassReverse http://127.0.0.1:1880/
    </Location>

</VirtualHost>

I've realized all three of them work fine if I try to put them on the "/" location. However, if I try to put them in unique locations as the following:

<VirtualHost *:80>

    ServerName 127.0.0.1

    <Location "/nodered/">
        ProxyPass http://127.0.0.1:1880/
        ProxyPassReverse http://127.0.0.1:1880/
    </Location>

    <Location "/jupyter/">
        ProxyPass http://127.0.0.1:8888/
        ProxyPassReverse http://127.0.0.1:8888/
    </Location>

    <Location "/pgadmin/">
        ProxyPass http://127.0.0.1:5433/
        ProxyPassReverse http://127.0.0.1:5433/
    </Location>

</VirtualHost>

None of them work on their respective addresses http://127.0.0.1/nodered/, http://127.0.0.1/jupyter/ or http://127.0.0.1/pgadmin/... I don't know what concepts I'm missing to make this work. I think I have to use RewriteRule but I'm not sure how. Is there any generic solution to deal with this kind of situation? Or do I need to know the particularities of each application I'm trying to proxy pass to make it work?

raylight
  • 111
  • 3
  • Did you check the error logs? – Esa Jokinen Dec 28 '22 at 06:24
  • So, what URIs get requested on backend servers? I suppose there could be some Javascript which doesn't have path replaced and which expects to be in /, not in, say, /jupyter/, so it wouldn't work. It is better not to change URI paths when reverse proxying. – Nikita Kipriyanov Dec 28 '22 at 07:19
  • Does this answer your question? [How to handle relative urls correctly with a reverse proxy](https://serverfault.com/questions/561892/how-to-handle-relative-urls-correctly-with-a-reverse-proxy) – diya Dec 28 '22 at 20:42
  • @diya Well, the last solution https://serverfault.com/a/690555/602714 on that question actually solved the problem of absolute paths on a React app that I made for testing it. But in the case of Node-RED, Jupyter, and pgAdmin that solution didn't work... And I don't think these apps have configurations for that... Probably there's no generic way of solving it on Apache in the end, I'm having problems with WebSocket pages on Node-RED and different kinds of problems with Jupyter and pgAdmin. So it probably requires me to understand the particularities of those applications to make it work. – raylight Dec 29 '22 at 06:49

0 Answers0