【发布时间】:2021-12-27 13:53:11
【问题描述】:
我正在尝试设置一个域 (example.com),它将 HTTPS 请求重定向到 HTTP localhost:8545
我在apache上试过如下配置(第一次尝试监听8082端口)
<VirtualHost *:8082>
ServerName example.com
SSLProxyEngine on
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://127.0.0.1:8545
ProxyPassReverse / http://127.0.0.1:8545
ErrorLog "/var/log/apache2/proxy-error.log"
CustomLog "/var/log/apache2/proxy-access.log" common
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
第二次尝试在proxy_conf-ssl.conf上如下
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.com
SSLProxyEngine on
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://127.0.0.1:8545
ProxyPassReverse / http://127.0.0.1:8545
ErrorLog "/var/log/apache2/proxy-error.log"
CustomLog "/var/log/apache2/proxy-access.log" common
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
但这些似乎都没有正常工作。我需要实现的是能够从需要 HTTPS 连接的移动 Metamask 访问在 0.0.0.0:8545 上运行的本地 ganache 客户端
【问题讨论】:
标签: https http-redirect metamask ganache