0

我有一个 symfony 应用程序,我正在使用 Mercure。

要运行 Mercure,我使用此命令

SERVER_NAME=:3000 MERCURE_PUBLISHER_JWT_KEY='something' MERCURE_SUBSCRIBER_JWT_KEY='something' CORS_ALLOWED_ORIGINS=https://my-domain.cz ALLOW_ANONYMOUS=1 ./mercure run -config Caddyfile

我已经安装了 Let's encrypt 颁发的 SSL 证书。我的阿帕奇:

<VirtualHost *:80>
....
ProxyRequests off
<LocationMatch /mercure>
ProxyPass http://localhost:3000
ProxyPassReverse http://localhost:3000

...
RewriteCond %{SERVER_NAME} =my-domain.cz
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

问题。当我尝试订阅某个主题时,会收到此错误

GET https://my-domain.cz:3000/.well-known/mercure?topic=someGoodTopic net::ERR_SSL_PROTOCOL_ERROR

如果我尝试从浏览器获取此 URL,我会遇到同样的问题,但如果我尝试使用 http://,一切都会好起来的,但不幸的是,我无法从我的 https 域请求 http。

(Mixed Content: The page at 'https://my-domain.cz/' was loaded over HTTPS, but requested an insecure EventSource endpoint 'http://my-domain.cz:3000/.well-known/mercure?topic=someGoodTopic'. This request has been blocked; the content must be served over HTTPS.)

如果有人可以帮助我,我会很高兴 =)

4

1 回答 1

0

不确定这是否是答案,但您的错误可能与允许匿名连接到mercure有关。除此之外它看起来还不错。不久前,我通过 https 设置了美居,实际上并没有任何具体的事情需要做。尝试使用 Mercure 设置身份验证,然后告诉我它是如何进行的。

于 2021-04-10T20:10:54.217 回答