Access Local Web Server Using Local IP Address

Apache2reverse-proxyssl

I have a server with Apache as a proxy for requests to a Node web service. I am currently able to connect using a browser outside of my local network using my domain name: https://mydomain.ca. I believe I used to be able to connect using a browser inside my local network using the server's local IP address: https://10.0.0.13. However, when I try now, I get a 500 error. I'm looking for help with getting this to work again. I'd also be okay with not using SSL on my local network and accessing the server with http://10.0.0.13 if that's more achievable.

I get the following text with the 500 error:

The proxy server could not handle the request 
Reason: Error during SSL Handshake with remote server

I went looking in my Apache error log (/var/log/apache2/error.log) for more clues, but I didn't find the text I found super helpful:

[Sun Nov 28 23:11:42.609115 2021] [proxy_http:error] [pid 28560:tid 140085584455424] [client 10.0.0.220:26070] AH01097: pass request body failed to 127.0.0.1:4201 (loca lhost) from 10.0.0.220 () 
[Sun Nov 28 23:11:42.769782 2021] [proxy:error] [pid 28560:tid 140085567670016] (20014)Internal error (specific information not available): [client
10.0.0.220:26071] AH 01084: pass request body failed to 127.0.0.1:4201 (localhost) 
[Sun Nov 28 23:11:42.769805 2021] [proxy:error] [pid 28560:tid 140085567670016] [client 10.0.0.220:26071] AH00898: Error during SSL Handshake with remote server returne d by /

Here is what my conf files look like:

mydomain.ca-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    ServerName mydomain.ca
    ServerAlias www.mydomain.ca
    ProxyPreserveHost on
    SSLProxyEngine on
    ProxyPass / https://localhost:4201/
    ProxyPassReverse / https://localhost:4201/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

ServerAlias mydomain.ca
SSLCertificateFile /etc/letsencrypt/live/mydomain.ca/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.ca/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

mydomain.ca.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName mydomain.ca
    ServerAlias www.mydomain.ca
    DocumentRoot /var/www/mydomain.ca
    ProxyPreserveHost on
    ProxyPass / http://localhost:4201/
    ProxyPassReverse / http://localhost:4201/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost>

EDIT – Here is some information about the Node web service:
The Node web service is listening on a single port and it is only listening to https connections.

Best Answer

You have configured both HTTP and HTTPS to connect to the same port on the backend server.

It is highly unlikely that your backend server supports both protocols on the same port.

Either use HTTP in both VirtualHosts, or use the correct port for HTTPS if your backend server supports both.

Related Topic