我正在尝试使用Apache作为运行cometd的Jetty服务器的反向代理。
我的设置是这样的:
Apache(HTTPS) --> Jetty(HTTP)
这是Apache conf文件
<VirtualHost *:443>
ServerAdmin xxx@domain.com
ServerName y.domain.com
ProxyPass / http://localhost:8888/
ProxyPassReverse / http://localhost:8888/
ProxyPass /ws/ ws://localhost:8888/
ProxyPass /wss/ wss://localhost:8888/
ProxyRequests Off
ProxyVia On
Timeout 1500
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<Proxy *>
Order deny,allow
Deny from all
Allow from all
</Proxy>
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/localhost.crt
SSLCertificateKeyFile /etc/apache2/ssl/localhost.key
SSLCertificateChainFile /etc/apache2/ssl/ca.crt
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
在客户端我使用cometd.js。
但是,我在握手期间在客户端上收到此错误
Error during WebSocket handshake: Unexpected response code: 400
地址为wss://y.domain.com
之后客户端再次尝试并且网站已经启动 - 但我担心握手是长时间的轮询...
我错过了什么?
答案 0 :(得分:2)
订购ProxyPass指令很重要
按配置顺序检查配置的ProxyPass和ProxyPassMatch规则。匹配胜利的第一条规则。
http://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass