当前位置:网站首页>NPM private server problem of peanut shell intranet penetration mapping

NPM private server problem of peanut shell intranet penetration mapping

2022-06-26 05:57:00 omage

The author once wrote a blog about how to build NPM Private clothes

How to use docker build npm Private clothes _omage The blog of -CSDN Blog Kung Fu in the world , Fast break not only !npm The default official server for downloading packages is npmjs:https://registry.npmjs.org/ Due to abroad and well-known reasons ,npm install Life is slow to doubt ... Fortunately, Alibaba provided the domestic Taobao image source taobao:https://registry.npm.taobao.org/ ( Ma Shoufu has made a lot of contributions ) We just need to click the local command to switch npm Package source settings npm Source npm config set registry https://registry.npm...https://blog.csdn.net/omage/article/details/117289205?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165465298516782390549972%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=165465298516782390549972&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~rank_v31_ecpm-1-117289205-null-null.nonecase&utm_term=verdaccio&spm=1018.2226.3001.4450 There is no problem accessing the intranet of the company , Later, due to the work needs of colleagues , It is necessary to solve the problem of accessing from the Internet NPM Private clothes , Use the peanut shell inner net penetration to map , After a simple configuration , Found a problem , namely verdaccio When mapping to the Internet , Some of the contents of the web pages are still referred to the intranet IP Address .

I looked for it verdaccio The solution of the official website , Adopted nginx Reverse proxy of , According to its configuration, the test failed

Reverse Proxy Setup | VerdaccioUsing a reverse proxy is a common practice. The following configurations are thehttps://verdaccio.org/docs/reverse-proxy/ Later, I thought about it myself , Changed configuration , Can run through , Now share the configuration .

server {
   listen 14873;
   location / {
        proxy_set_header Accept-Encoding '';
        proxy_pass http://192.1.1.10:4873/;
        sub_filter 'http://192.1.1.10:4873' '$scheme://$http_host';
        sub_filter_once off;
        sub_filter_types *;
   }
}

Be careful :proxy_set_header Accept-Encoding ''; This is to prevent verdaccio Turn on gzip,sub_filter Cannot replace compressed web page content

原网站

版权声明
本文为[omage]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260546208428.html