Apache 为什么不是';我的TLS ngrok隧道有问题吗?

Apache 为什么不是';我的TLS ngrok隧道有问题吗?,apache,ssl,curl,ngrok,Apache,Ssl,Curl,Ngrok,当我运行curl--unsecure'https://foo.ngrok.io/page“在连接到基于Apache IP的虚拟主机的TLS通道上,我收到一个“400错误请求”响应您的浏览器发送了一个此服务器无法理解的请求…原因:您正在对启用SSL的服务器端口使用纯HTTP…请改用HTTPS方案访问此URL 但是,如果我使用curl直接向本地主机地址发出请求,例如,curl--unsecure'https://foo/page“我得到了正确的响应。另外,如果我在浏览器中请求https://foo.

当我运行
curl--unsecure'https://foo.ngrok.io/page“
在连接到基于Apache IP的虚拟主机的TLS通道上,我收到一个“400错误请求”响应您的浏览器发送了一个此服务器无法理解的请求…原因:您正在对启用SSL的服务器端口使用纯HTTP…请改用HTTPS方案访问此URL

但是,如果我使用curl直接向本地主机地址发出请求,例如,
curl--unsecure'https://foo/page“
我得到了正确的响应。另外,如果我在浏览器中请求
https://foo.ngrok.io/page
我得到了正确的回答

我正在运行:OSX10.9.5、Apache2.4、ngrok2和Curl7.43.0。我的SSL证书是自签名的

我从访问日志中注意到,当我在
foo.ngrok.io
上使用curl时,我的
HTTP/1.1
请求被更改为
HTTP/1.0
请求。此外,下面是我的错误日志中相应的相关位:

ssl_engine_kernel.c(1824): [client 127.0.0.2:50517] OpenSSL: Exit: error in SSLv2/v3 read client hello A
[client 127.0.0.2:50517] AH01996: SSL handshake failed: HTTP spoken on HTTPS port; trying to send HTML error page
SSL Library Error: error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request -- speaking HTTP to HTTPS port!?
protocol.c(616): [client 127.0.0.2:50517] Request received from client: GET / HTTP/1.0
http_filters.c(1042): [client 127.0.0.2:50517] Response sent with status 400, headers:
Apache虚拟主机配置

Listen 127.0.0.2:443
<VirtualHost 127.0.0.2:443>
        ServerName foo
        DocumentRoot /Users/me/site
        ErrorLog "/usr/local/var/log/apache2/foo_error_log"
        CustomLog "/usr/local/var/log/apache2/foo_access_log" common
        <Directory "/Users/me/site">
                AllowOverride All
                Allow from All
                Options -Indexes
        </Directory>
        <IfModule ssl_module>
                SSLEngine on
                <Directory "/Users/me/site">
                        SSLOptions +StdEnvVars
                </Directory>
                SSLCertificateKeyFile "/usr/local/etc/apache2/2.4/ssl/foo.key"
                SSLCertificateFile "/usr/local/etc/apache2/2.4/ssl/foo.crt"
        </IfModule>
</VirtualHost>
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect file:/dev/urandom 512
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLPassPhraseDialog  builtin
SSLSessionCache "shmcb:/usr/local/var/run/apache2/ssl_scache(512000)"
SSLSessionCacheTimeout 300
authtoken: <omitted>
tunnels:
  foo:
    addr: 127.0.0.2:443
    proto: tls
    hostname: "foo.ngrok.io"
ngrok.yml配置

Listen 127.0.0.2:443
<VirtualHost 127.0.0.2:443>
        ServerName foo
        DocumentRoot /Users/me/site
        ErrorLog "/usr/local/var/log/apache2/foo_error_log"
        CustomLog "/usr/local/var/log/apache2/foo_access_log" common
        <Directory "/Users/me/site">
                AllowOverride All
                Allow from All
                Options -Indexes
        </Directory>
        <IfModule ssl_module>
                SSLEngine on
                <Directory "/Users/me/site">
                        SSLOptions +StdEnvVars
                </Directory>
                SSLCertificateKeyFile "/usr/local/etc/apache2/2.4/ssl/foo.key"
                SSLCertificateFile "/usr/local/etc/apache2/2.4/ssl/foo.crt"
        </IfModule>
</VirtualHost>
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect file:/dev/urandom 512
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLPassPhraseDialog  builtin
SSLSessionCache "shmcb:/usr/local/var/run/apache2/ssl_scache(512000)"
SSLSessionCacheTimeout 300
authtoken: <omitted>
tunnels:
  foo:
    addr: 127.0.0.2:443
    proto: tls
    hostname: "foo.ngrok.io"
authtoken:
隧道:
傅:
地址:127.0.0.2:443
原型:tls
主机名:“foo.ngrok.io”

目前,HTTP客户端(curl、浏览器等)必须支持SNI才能通过HTTPS与ngrok通信。这涉及TLS和HTTP ngrok隧道。

目前,HTTP客户端(curl、浏览器等)必须支持SNI才能通过HTTPS与ngrok通信。这涉及TLS和HTTP ngrok隧道。

尝试在curl命令后添加-k。例如:


curl{domain}com.ngrok.io/webhook-k

尝试在curl命令后添加-k。例如:


curl{domain}com.ngrok.io/webhook-k

注意:真正的问题不是我不能使用curl,而是我使用ngrok制作webhook的服务也有同样的问题。注意:真正的问题不是我不能使用curl,而是我使用ngrok制作webhook的服务也有同样的问题。