
Node 웹 서비스에 대한 요청을 위한 프록시로 Apache를 사용하는 서버가 있습니다. 현재 내 도메인 이름을 사용하여 로컬 네트워크 외부의 브라우저를 사용하여 연결할 수 있습니다: https://mydomain.ca
. 나는 믿는다사용된서버의 로컬 IP 주소를 사용하여 내 로컬 네트워크 내에서 브라우저를 사용하여 연결할 수 있습니다: https://10.0.0.13
. 그런데 지금 시도하면 500 오류가 발생합니다. 이 작업을 다시 수행하는 데 도움을 구하고 있습니다. 로컬 네트워크에서 SSL을 사용하지 않고 http://10.0.0.13
더 가능하다면 서버에 액세스해도 괜찮습니다 .
500 오류와 함께 다음 텍스트가 표시됩니다.
The proxy server could not handle the request
Reason: Error during SSL Handshake with remote server
더 많은 단서를 찾기 위해 Apache 오류 로그(/var/log/apache2/error.log)를 살펴봤지만 매우 도움이 되는 텍스트를 찾지 못했습니다.
[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 /
내 conf 파일은 다음과 같습니다.
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>
편집 - Node 웹 서비스에 대한 몇 가지 정보는 다음과 같습니다. Node 웹 서비스는 단일 포트에서 수신 대기하며 https 연결만 수신합니다.
답변1
백엔드 서버의 동일한 포트에 연결하도록 HTTP와 HTTPS를 모두 구성했습니다.
백엔드 서버가 동일한 포트에서 두 프로토콜을 모두 지원할 가능성은 거의 없습니다.
두 VirtualHost 모두에서 HTTP를 사용하거나, 백엔드 서버가 두 가지를 모두 지원하는 경우 HTTPS에 올바른 포트를 사용하십시오.
답변2
위의 댓글 중 일부는 제가 이 문제에 대해 올바른 생각을 하게 만들었습니다. 내가 사용한 접근 방식은 다음과 같습니다.
- 내 Node 웹 서비스 내의 다른 포트에서 별도의 http 및 https 서버를 실행합니다.
- 올바른 포트 번호에 해당하도록 mydomain.ca.conf 및 mydomain.ca-le-ssl.conf의 포트 번호를 업데이트합니다.
- 아래와 같이 localhost 또는 LAN의 요청에만 응답하도록 mydomain.ca.conf를 업데이트합니다.
<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> ...
이 모든 것이 준비되었으므로 이제 http://10.0.0.13
로컬 네트워크 내부와 https://mydomain.ca
로컬 네트워크 외부에서 액세스할 수 있습니다.