问题原文
原帖链接 · grasswistle · CC BY-SA 4.0
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.
已采纳解答
原帖链接 · grasswistle · CC BY-SA 4.0
Some of the comments above got me thinking about this the right way. The approach I went with was to
- run separate http & https servers on different ports within my Node web service,
- update the port numbers in mydomain.ca.conf and mydomain.ca-le-ssl.conf to correspond to the right port numbers, and
- update mydomain.ca.conf to only respond to requests from localhost or LAN as shown below.
<VirtualHost *:80> # We should only access the web server via http if on localhost # or within LAN. <Location /> Require local Require ip 10.0.0.0/24 </Location> ...
With all this in place, I can now access http://10.0.0.13 from inside my local network and https://mydomain.ca from outside my local network.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
