verdaccio和nginx(拒绝连接)



使用docker和nginx (ssl)不在docker中。在浏览器http://my.site/verdaccio/我没有任何问题,但在HTTPS我没有看到包"没有包发布尚未。">

我得到错误在浏览器:

拒绝连接"http://my"。site/verdaccio/-/verdaccio/packages',因为它违反了以下内容安全策略

conf nginx like:

location /verdaccio/ {
proxy_pass http://localhost:6666/;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
add_header 'Content-Security-Policy' 'upgrade-insecure-requests';

如果我使用推荐的配置,页面不加载:

location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:6666;
proxy_redirect off;
}

并得到一些错误:

Mixed Content: The page at 'https://my.site/verdaccio/' was loaded over HTTPS, but requested an insecure script 'http://my.site/verdaccio/-/static/main.f6e570dfe38870ab429f5.js'. This request has been blocked; the content must be served over HTTPS.

设置VERDACCIO_PUBLIC_URLenv变量为https://my.site

在我的配置中url_prefix: /verdaccio/

我重新创建容器,它工作。

相关内容

  • 没有找到相关文章

最新更新