我有一个 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.)
如果有人可以帮助我,我会很高兴 =)