在线客服插件 https网站添加代理
Nginx服务器:
location /wss { proxy_pass http://localhost:8282; # 请将该端口号替换为你实际使用的端口 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; }
Apache服务器:
ProxyPass /wss ws://localhost:8282/
ProxyPassReverse /wss ws://localhost:8282/
以宝塔nginx为例:
打到你的网站->设置->配置文件-》server最下面添加
踩坑1
#伪静态中,以下代码可能导至 WebSocket connection to 'wss://XXXXX/wss' failed:
if (!-e $request_filename) {
return 404;
}
删掉即可
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
IIS环境服务器(iis 插件原则上不支持,因为我也没测试过,懒得弄,但有用户已经设置成功了)
<rule name="http" enabled="true" stopProcessing="true"> <match url="^(.*?)/?wss(.*)$" /> <action type="Rewrite" url="{C:1}://localhost:8282/{R:2}" /> <conditions> <add input="{CACHE_URL}" pattern="(.+)s://" /> <add input="{CACHE_URL}" pattern="(.*)s://" /> </conditions> </rule>
看看