簡體   English   中英

verdaccio 和 nginx(拒絕連接)

[英]verdaccio and nginx (refused to connect)

使用 docker 和 nginx (ssl) 不在 docker 中。 在瀏覽器http://my.site/verdaccio/中我沒有任何問題,但在 HTTPS 中我看不到包“尚未發布包”。

我在瀏覽器中收到錯誤:

拒絕連接到“http://my.site/verdaccio/-/verdaccio/packages”,因為它違反了以下內容安全政策

conf nginx 喜歡:

 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';

如果我使用推薦的 conf,頁面不會加載:

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_URL變量設置為https://my.site

在我的配置中url_prefix: /verdaccio/

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM