url_prefix changed behaviour with 4.2.2
See original GitHub issueI had Verdaccio 4.2.1 running behind an apache proxy working well and just tried upgrading to latest and it’s no longer working. Tracked the change in behaviour to 4.2.2.
I have the prefix configured in verdaccio’s config:
url_prefix: /npm/
Apache proxy config:
<Location /npm/>
ProxyPass https://127.0.0.1:4873/ nocanon
ProxyPassReverse https://127.0.0.1:4873/
ProxyPreserveHost On
</Location>
With 4.2.1, this is working perfectly. Here’s a diff of the initial GET response from 4.2.1 and 4.2.2 out of Verdaccio itself (not apache):
--- good.4.2.1.txt 2019-10-16 15:20:18.931210851 +0100
+++ bad-4.2.2.txt 2019-10-16 15:19:44.480775891 +0100
@@ -15,12 +15,12 @@
window.VERDACCIO_SCOPE = '';
window.VERDACCIO_LOGO = '';
window.VERDACCIO_PRIMARY_COLOR = '';
- window.VERDACCIO_VERSION = '4.2.1';
+ window.VERDACCIO_VERSION = '4.2.2';
</script>
-<link rel="shortcut icon" href="http://ukserver.activfinancial.com/npm/-/static/favicon.ico"><link href="http://ukserver.activfinancial.com/npm/-/static/0.style.026be7a5bc0c57143eb2.css" rel="stylesheet"><link href="http://ukserver.activfinancial.com/npm/-/static/2.style.92647ec0a7beb8b2898d.css" rel="stylesheet"></head>
+<link rel="shortcut icon" href="/-/static/favicon.ico"><link href="/-/static/0.style.2ea8a5d1276179958242.css" rel="stylesheet"><link href="/-/static/2.style.92647ec0a7beb8b2898d.css" rel="stylesheet"></head>
<body class="body">
<div id="root"></div>
-<script type="text/javascript" src="http://ukserver.activfinancial.com/npm/-/static/manifest.36047715e70284b71dcd.js"></script><script type="text/javascript" src="http://ukserver.activfinancial.com/npm/-/static/vendors.36047715e70284b71dcd.js"></script><script type="text/javascript" src="http://ukserver.activfinancial.com/npm/-/static/main.36047715e70284b71dcd.js"></script></body>
+<script type="text/javascript" src="/-/static/manifest.64e04f9f5e62cc8e0fd4.js"></script><script type="text/javascript" src="/-/static/vendors.64e04f9f5e62cc8e0fd4.js"></script><script type="text/javascript" src="/-/static/main.64e04f9f5e62cc8e0fd4.js"></script></body>
</html>
As you can see, scripted sources are relative in 4.2.2. I can’t see anything in the changelog that would indicate a config change is required or what else might have caused this (maybe it should never have worked like I have it configured?).
A quick diff of the 4.2.1 and 4.2.2 tags shows few changes to verdaccio so I guess it’s one of the dependencies, but I’ve no idea where …
There are a few other issues referencing url_prefix, but they seem to predate 4.2.2 so presumably aren’t related. Apologies if this is just noise, but I am a bit stumped…
Regards
Issue Analytics
- State:
- Created 4 years ago
- Comments:25 (6 by maintainers)
Top GitHub Comments
Sorry if it wasn’t clear from my previous message, I don’t think it’s anything to do with apache as I get the exact same behaviour with nginx on my server.
Also, since then, I managed to get docker-examples/reverse_proxy/nginx/relative_path running, and that shows the issue too if the
location /
section is removed.With the default config from the example (
location /
still there), then you can see a bunch of requests don’t have the url_prefix. Here’s a quick summary of the URLs (as seen from the browser in this case):… and so on …
Regards
I am experiencing the exact same problem. Only the favicon is correctly retrieved from the url_prefix. Everything else is served from root, which is not where the files reside. The favicon in the template uses: htmlWebpackPlugin.options.verdaccioURL to retreive the correct URL for the config.
I think it may be the rootURL in the env.js. https://github.com/verdaccio/ui/blob/master/config/env.js
The API is still working correctly and a comparison of the two shows they resolve this path differently. This looks to have changed in the UI here: https://github.com/verdaccio/ui/commit/6b5d0b7e2e37c4f0324b17b5794a01ebec49a71e#diff-8cc96276187f94a8094f05846514a3a7