-
Notifications
You must be signed in to change notification settings - Fork 155
update external rewrite destination in pages-router #723
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
Conversation
|
the current url used for the pages-router external rewrite (https://opennext.js.org/share.png) errors when being fetched from a Cloudflare worker, to solve that the url has been updated to a github link (https://github.com/raw/opennextjs/docs/refs/heads/main/public/share.png) which points to the same exact image
db0c436
to
cf35bbf
Compare
Coverage Report
File CoverageNo changed files found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks!
Just one thing about that issue, does it mean that external rewrites to website hosted on cloudflare would fail with this error on workers ? If that's the case it should probably be added to the docs
My understanding is that it fails only if the workers are in the same data center - not saying it's much better, only giving some context. |
@conico974 that's a good point, I also tried reproducing this with a simple worker but there this issue doesn't seem to appear, which makes me think that this might be related on how Next.js rewrites work 🤔 shall I create a new github issue to track this? |
If the issue is with OpenNext yeah you should create an issue here. |
This is definitely a cloudflare infra limitation. |
@vicb I wasn't saying that it's not a Cloudflare infra limitation, I was just saying that it doesn't always happen (e.g. I can fetch the image from a worker) and something in Next.js/OpenNext is triggering it, so it would be good to investigate that and understand specifically what is triggering it and if anything can be changed to address it (maybe not, but it'd still might be worth an investigation) |
@dario-piotrowicz Are you adding header while fetching the image ? This kind of rewrite does not touch Next code
Might be one of those, other than that i don't see anything that could cause this kind of issue in OpenNext code |
Mostly what I said in my first message :) inter colo works fine. |
No I'm not doing any of that 😕, this comes straight from copy-pasting the |
@dario-piotrowicz i took a quick look, and as i suspected cloudflare sets
Maybe it's safer to just remove any cf-* header ?
|
@conico974 you're a legend! 🚀 🚀 🚀 ❤️ 🚀🚀 🚀
I think we can, but since |
@conico974 what shall we do here? shall I close the PR? or update it to filer out the header? (PS: I am happy to do that but I then don't know how to test this, maybe testing it in the Cloudflare repo will be enough? (since there I would revert back the url change)) |
It's probably cleaner to make a new PR for the header, as for the test we can't really do e2e test here for that because the fetch proxy don't really work on node. |
Cool, I'm on it 🫡 |
Closing as per the above comments |
the current url used for the pages-router external rewrite (https://opennext.js.org/share.png) errors when being fetched from a Cloudflare worker, the error being:

To solve that the url has been updated to a github link (https://github.com/raw/opennextjs/docs/refs/heads/main/public/share.png) which points to the same exact image
I had to make this change in the Cloudflare repo and I am replicating the same change here to keep our tests in sync, see: original conversation