1

我正在尝试通过 nodejs 和 jsmpeg 在 uberspace 之间传输视频数据。

我的问题是我在尝试访问 url 时收到 404:

The requested URL /receive was not found on this server.

我访问的网址是这样的: https://stream.mydomain.com/receive

这是我的.htaccess:

DirectoryIndex disabled
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^send/(.*) http://localhost:61624/$1
RewriteRule ^receive/(.*) ws://localhost:61625/$1
</IfModule>
4

1 回答 1

1

这里有两件事。

1) 此规则RewriteRule ^receive/(.*) ws://localhost:61625/$1/receive/xxx后面的斜杠匹配receivexxx部分可选)。因此,您至少需要/receive/在您的情况下访问。这是你所期望的吗?如果没有,只需调整您的规则。

2)您需要同时使用mod_proxy这两个规则(使用P标志)

RewriteRule ^send/(.*)$ http://localhost:61624/$1 [P]
RewriteRule ^receive/(.*)$ ws://localhost:61625/$1 [P]

但请注意,此方法不是最快的。如果可能,请在您的 apache 配置中使用ProxyPassandProxyPassReverse而不是 htaccess。

于 2018-10-24T12:51:13.910 回答