首页 > 解决方案 > 从 Apache 代理反向中的重定向 URL 传递多个参数

问题描述

我正在运行一个利用laravel-echo-server的应用程序。因此,为了让我在生产服务器上运行它,https我需要使用 apache 代理反向将我的/tools/socket.io/url 重定向到http://localhost:6001.

虽然这工作正常,但我一直收到此错误Cannot Post /,因为我需要将参数从我的域 url 传递到我的反向代理 url。这是我的 apache 配置:

ProxyPreserveHost On
ProxyRequests off
ProxyPass /tools/socket.io/ http://localhost:6001/
ProxyPassReverse /tools/socket.io/ http://localhost:6001/

我遇到了这个帖子堆栈溢出,但实现对我不起作用。

所以这是我需要传递的参数,它们的值是动态的EIO transport t。我的网址就像

https://exampledomain.com/tools/socket.io/?EIO=3&transport=polling&t=Ml8lZDJ

标签: apachelaravel-echo

解决方案


这是我的域的 SSL 虚拟主机中的 apaxhe 配置:

RewriteEngine On
RewriteCond %{REQUEST_URI}  ^/socket.io            [NC]
RewriteCond %{QUERY_STRING} transport=websocket    [NC]
RewriteRule /(.*)           ws://localhost:6001/$1 [P,L]

ProxyPass        /socket.io http://localhost:6001/socket.io
ProxyPassReverse /socket.io http://localhost:6001/socket.io

推荐阅读