Search code examples
node.jsapachereverse-proxy

Reverse Proxy with Apache for Node.js


I've been trying for hours (unsuccessfully) to get a reverse proxy via Apache for my Node.js application. The application is Send https://gitlab.com/timvisee/send I am almost at the end of my rope, the proxy works, but always shows me only an almost empty application. https://ibb.co/8MNTZm0

This is my Apache configuration The one for port 80 just forwards

  GNU nano 7.2                   send.furrysend.de-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>

ServerName send.furrysend.de

ProxyPass / http://185.216.179.27:8080
ProxyPassReverse / http://185.216.179.27:8080
ProxyPreserveHost On

SSLCertificateFile /etc/letsencrypt/live/send.furrysend.de/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/send.furrysend.de/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

I would be very happy about help, I strongly think that it is only due to certain switches in the settings.

The IP address can be used to see what it should look like http://185.216.179.27:8080/ address is already redirected

I had already tried nginx without success

I have already tried every conceivable switch without success. I just don't understand why it doesn't work

apache error log

[Sat May 25 00:00:26.473069 2024] [mpm_event:notice] [pid 4390:tid 140081991391104] AH00489: Apache/2.4.59 (Debian) OpenSSL/3.0.11 configured -- > [Sat May 25 00:00:26.473134 2024] [core:notice] [pid 4390:tid 140081991391104] AH00094: Command line: '/usr/sbin/apache2' [Sat May 25 01:06:22.616820 2024] [proxy:error] [pid 13981:tid 140081750791872] (EAI 2)Name or service not known: [client 152.89.198.175:41760] A> [Sat May 25 01:06:22.854293 2024] [proxy:error] [pid 13982:tid 140081834718912] (EAI 2)Name or service not known: [client 152.89.198.175:41768] A> [Sat May 25 01:06:47.148130 2024] [proxy:error] [pid 13982:tid 140081817933504] (EAI 2)Name or service not known: [client 52.76.71.100:1228] AH00> [Sat May 25 01:06:48.099864 2024] [proxy:error] [pid 13982:tid 140081784362688] (EAI 2)Name or service not known: [client 52.76.71.100:46536] AH0> [Sat May 25 01:06:49.048600 2024] [proxy:error] [pid 13982:tid 140081767577280] (EAI 2)Name or service not known: [client 52.76.71.100:59733] AH0> [Sat May 25 01:06:50.003296 2024] [proxy:error] [pid 13982:tid 140081851504320] (EAI 2)Name or service not known: [client 52.76.71.100:64279] AH0> [Sat May 25 01:06:50.950113 2024] [proxy:error] [pid 13982:tid 140081742399168] (EAI 2)Name or service not known: [client 52.76.71.100:48839] AH0> [Sat May 25 01:09:14.612828 2024] [proxy:error] [pid 13982:tid 140081725613760] (EAI 2)Name or service not known: [client 203.55.81.13:54266] AH0> [Sat May 25 01:09:15.589433 2024] [proxy:error] [pid 13982:tid 140081717221056] (EAI 2)Name or service not known: [client 203.55.81.13:54254] AH0> [Sat May 25 02:22:57.937057 2024] [proxy:error] [pid 13982:tid 140081792755392] (EAI 2)Name or service not known: [client 149.50.110.239:46090] A> [Sat May 25 02:37:44.536095 2024] [proxy:error] [pid 13982:tid 140081784362688] (EAI 2)Name or service not known: [client 203.55.81.13:44548] AH0> [Sat May 25 02:37:46.241278 2024] [proxy:error] [pid 13982:tid 140081775969984] (EAI 2)Name or service not known: [client 203.55.81.13:44556] AH0> [Sat May 25 03:33:14.156521 2024] [proxy:error] [pid 13981:tid 140081742399168] (EAI 2)Name or service not known: [client 103.228.37.56:48492] AH> [Sat May 25 03:46:22.252391 2024] [proxy:error] [pid 13981:tid 140081717221056] (EAI 2)Name or service not known: [client 203.55.81.13:36040] AH0> [Sat May 25 03:46:22.252381 2024] [proxy:error] [pid 13982:tid 140081885075136] (EAI 2)Name or service not known: [client 203.55.81.13:36052] AH0> [Sat May 25 03:53:18.408023 2024] [proxy_http:error] [pid 13982:tid 140081859897024] (20014)Internal error (specific information not available): > [Sat May 25 03:53:18.408161 2024] [proxy:error] [pid 13982:tid 140081859897024] [client 87.121.69.52:57962] AH00898: Error reading from remote se> [Sat May 25 04:05:17.923588 2024] [proxy:error] [pid 13982:tid 140081801148096] (EAI 2)Name or service not known: [client 115.231.78.12:9484] AH0> [Sat May 25 04:05:18.336876 2024] [proxy:error] [pid 13982:tid 140081792755392] (EAI 2)Name or service not known: [client 115.231.78.12:35401] AH> [Sat May 25 04:05:19.281043 2024] [proxy:error] [pid 13982:tid 140081826326208] (EAI 2)Name or service not known: [client 115.231.78.12:58458] AH> [Sat May 25 04:05:20.706212 2024] [proxy:error] [pid 13982:tid 140081775969984] (EAI 2)Name or service not known: [client 115.231.78.12:15059] AH> [Sat May 25 04:05:21.126566 2024] [proxy:error] [pid 13981:tid 140081843111616] (EAI 2)Name or service not known: [client 115.231.78.12:59105] AH> [Sat May 25 04:05:21.893835 2024] [proxy:error] [pid 13981:tid 140081851504320] (EAI 2)Name or service not known: [client 115.231.78.12:32734] AH> [Sat May 25 04:05:22.687431 2024] [proxy:error] [pid 13982:tid 140081759184576] (EAI 2)Name or service not known: [client 115.231.78.12:30853] AH> [Sat May 25 04:06:31.000079 2024] [proxy_http:error] [pid 13981:tid 140081885075136] (20014)Internal error (specific information not available): > [Sat May 25 04:06:31.000311 2024] [proxy:error] [pid 13981:tid 140081885075136] [client 82.197.67.219:42124] AH00898: Error reading from remote s> [Sat May 25 04:15:27.429034 2024] [proxy:error] [pid 13982:tid 140081725613760] (EAI 2)Name or service not known: [client 84.54.51.37:48676] AH00> [Sat May 25 04:37:51.110362 2024] [core:error] [pid 13981:tid 140081834718912] [client 111.20.182.26:2568] AH10244: invalid URI path (/cgi-bin/.%> [Sat May 25 04:37:51.598528 2024] [core:error] [pid 13981:tid 140081817933504] [client 111.20.182.26:2569] AH10244: invalid URI path (/cgi-bin/%%> [Sat May 25 04:37:52.098438 2024] [proxy:error] [pid 13981:tid 140081784362688] (EAI 2)Name or service not known: [client 111.20.182.26:2570] AH0> [Sat May 25 04:37:54.637177 2024] [proxy:error] [pid 13981:tid 140081801148096] (EAI 2)Name or service not known: [client 111.20.182.26:2571] AH0> [Sat May 25 04:37:55.021555 2024] [proxy:error] [pid 13981:tid 140081767577280] (EAI 2)Name or service not known: [client 111.20.182.26:2572] AH0> [Sat May 25 04:37:55.534621 2024] [proxy:error] [pid 13982:tid 140081717221056] (EAI 2)Name or service not known: [client 111.20.182.26:2573] AH0> [Sat May 25 04:37:56.062104 2024] [proxy:error] [pid 13981:tid 140081792755392] (EAI 2)Name or service not known: [client 111.20.182.26:2574] AH0> [Sat May 25 04:37:56.447541 2024] [proxy:error] [pid 13981:tid 140081734006464] (EAI 2)Name or service not known: [client 111.20.182.26:2575] AH0> [Sat May 25 04:37:56.827711 2024] [proxy:error] [pid 13981:tid 140081700435648] (EAI 2)Name or service not known: [client 111.20.182.26:2576] AH0> [Sat May 25 04:37:57.443045 2024] [proxy:error] [pid 13981:tid 140081876682432] (EAI 2)Name or service not known: [client 111.20.182.26:2577] AH0> [Sat May 25 04:37:57.825470 2024] [proxy:error] [pid 13981:tid 140081901860544] (EAI 2)Name or service not known: [client 111.20.182.26:2578] AH0> [Sat May 25 04:37:58.180891 2024] [proxy:error] [pid 13981:tid 140081809540800] (EAI 2)Name or service not known: [client 111.20.182.26:2579] AH0> [Sat May 25 04:37:59.559212 2024] [proxy:error] [pid 13981:tid 140081750791872] (EAI 2)Name or service not known: [client 111.20.182.26:2580] AH0> [Sat May 25 04:37:59.924890 2024] [proxy:error] [pid 13981:tid 140081893467840] (EAI 2)Name or service not known: [client 111.20.182.26:2581] AH0> [Sat May 25 04:38:00.421779 2024] [proxy:error] [pid 13981:tid 140081868289728] (EAI 2)Name or service not known: [client 111.20.182.26:2582] AH0> [Sat May 25 04:38:00.944956 2024] [proxy:error] [pid 13981:tid 140081859897024] (EAI 2)Name or service not known: [client 111.20.182.26:2583] AH0> [Sat May 25 04:38:01.317814 2024] [proxy:error] [pid 13982:tid 140081700435648] (EAI 2)Name or service not known: [client 111.20.182.26:2584] AH0>


Solution

  • If the proxy start url has a trailing slash, your target url also needs a trailing slash

    As your proxy is on the public/main directory & not a sub-directory (Just /) it in itself is a trailing slash. Therefore you need to add trailing slash to the target url too:

    ProxyPass / http://185.216.179.27:8080/
    ProxyPassReverse / http://185.216.179.27:8080/
    ProxyPreserveHost On
    

    I replicated the same issue on my side & tested the above to confirm it works. The output after adding trailing slashes: Output with trailing slashes