-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
url_prefix changed behaviour with 4.2.2 #1523
Comments
@lukebelliott I was testing https://github.com/verdaccio/docker-examples/tree/master/reverse_proxy/nginx with all v4 versions, no difference at all. Unfortunately I have no apache example for relative paths, only a normal setup from root. If you are able to reproduce it with any example in that repo let me know. I |
I tried to get the reverse_proxy/nginx/relative_path example working, but it fails with Instead I tried a nginx setup on my server using:
And it fails the same way as apache for me (with either version). That initial GET from verdaccio has, for example:
which unless the proxy is going to start rewriting bodies surely can't work? Looking at the nginx config in the repo, isn't it serving from both / and /verdaccio? So the non-prefixed hrefs in the initial GET response will still work? If I add in / to my nginx setup:
to look like the example in the repo, then it does indeed work, but everything is served off /. Like I say, happy to try with the docker example if someone could let me know what I'm missing! Thanks |
I'm not super expert in Apache unfortunately, but please provide a repo with examples of your configuration, so anyone can try to reproduce it. Let's see wether someone with Apache skills can help here. |
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 With the default config from the example (
... 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. 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: verdaccio/ui@6b5d0b7#diff-8cc96276187f94a8094f05846514a3a7 |
I am also experiencing the same issue here. We have an internal reverse proxy similar to nginx. The static files are not getting resolved as they were in 4.2.1 |
A workaround for those that are using Nginx, and have this problem. Amend your config to rewrite those paths back in, there were some additional changes that were needed.
|
Ok. For now I have rebuilt the ui with this change reverted and replaced it in the verdaccio installation. It is working fine for now. Need a permanent fix for this. |
We also just updated, and fell on this issue. We did the same than @chrisbertrandsagecom. Also this issue also requires the nginx tag. |
I'm having the same problem. Brand new install today. Looking at the webpack.config.js in the ui repo, it looks like it might be because of the This would mean it's not a web server configuration problem. It's a code problem. I'm going to take others' advice and downgrade to 4.2.1 until this gets fixed. ✌️ Edit: FWIW, here is
|
I can confirm this issue on Kubernetes as well (using Istio for reverse proxy). |
I appreciate the feedback, but, I think each of you is having this issue, please, share your configuration, context, etc, otherwise would be hard to narrow down the issue. If it is the same as above, confirm it 🙏 also would be helpful for triage this. As much context, the better. |
@nsainaney you can fix this issue using Istio as reverse proxy forcing Istio to add the X-Forwarded-Proto and X-Forwarded-Port headers Example apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: npm
spec:
hosts:
- 'npm.my-server.com'
gateways:
- istio-gateway
http:
- route:
- destination:
host: verdaccio
port:
number: 4873
headers:
request:
set:
X-Forwarded-Proto: "https"
X-Forwarded-Port: "443" |
Thanks @taffarel-gaivota. We opted to route based on verdaccio being its own host (verdaccio.xxx.example.com) and it's working fine now but we'll test the above and circle back with a config that can reliably reproduce the issue. |
For those who are using Apache server you can do some as this
and for Nginx you can do something like this:
|
confirm this issue on 4.6.2 |
I can confirm the issue when loading the index.html page on my side too.
template.replace(/ToReplaceByVerdaccio/g, base) But in ìndex.html` template there is: ...
<link rel="icon" type="image/png" href="ToReplaceByVerdaccio/-/static/favicon.ico" />
...
<link rel="shortcut icon" href="/-/static/favicon.ico">
<link href="/-/static/0.style.b3d2b69b057068c678ca.css" rel="stylesheet">
...
<script type="text/javascript" src="/-/static/manifest.23e9430e154f72ad4c9c.js"></script>
<script type="text/javascript" src="/-/static/vendors.23e9430e154f72ad4c9c.js"></script>
<script type="text/javascript" src="/-/static/main.23e9430e154f72ad4c9c.js"></script>
... => not all URL are prefixed with base
|
@harty911 explained the problem very acurate. The reason, why @juanpicado can't reproduce the problem is, that the example (https://github.com/verdaccio/docker-examples/tree/master/reverse_proxy/nginx) is serving an instance on http://localhost/ and http://localhost/verdaccio. So the broken links from the second instance are served from the first instance. As @harty911 already mentioned, a deeper look into the browser tools disclose the bug. I think it would be a good idea to also fix the example to something like that:
Thanks for all your efford 👍 |
It looks like this was introduced when the prefix was removed in verdaccio/ui#122. So, to link in the relevant GitHub issues:
|
You can start to test the branch pulling this.
It will update automatically when new commits are pushed. No npm version ready yet. On this version you can use the env variable
The Furthermore, the UI does not contain CSS, svg and reduce to minimum the HTTP requests. |
FYI, fix for this is on verdaccio 5. |
I 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:
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):
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
The text was updated successfully, but these errors were encountered: