I setup it up like in the docs
In chrome its does work fine but in firefox i get this errorNS_BINDING_ABORTED
#Firefox prefetching NS_BINDING_ABORTED
1 messages · Page 1 of 1 (latest)
I’m having the same issue, can see the prefetchs happening fine in chrome but Firefox they fail in the same way
I swapped browsers mid development and never thought to recheck this haha
cc @dawn sable who might have thoughts
Otherwise would appreciate an issue with a reproduction!
Oof. Let's get this bug fixed.
Please open an issue on the withastro/astro repo.
Well apparently my prefetch in firefox was disabled, after enabling that however my issue now exactly matches OP's with the NS_BINDING_ABORTED
I closed the github issue however as the minimal repro worked fine after enabling prefetch so something else appears to be happening here
<@&1129102257422610512> any further guidance would be appreciated ❤️
When i access the project over stackblitz the prefetching does work but when im running the project locally it does not work
Have you seen this? https://github.com/withastro/astro/issues/10464
This seems to happen when no cache or expire headers are returned. Is it also a problem when deployed? According to bluwy's summary at the bottom the prblem should disappear if those headers are set
Happens on my deployed site as well
I am using ssr as well, bit confused as to where I would need to add these headers though
That issue does seem to be the exact thing going on here
You would have to configure that on whatever hoster you're using. Normally they return those headers automatically
But yeah, it's possible your issue is different
It will show a NS_BINDING_ABORTED error if Cache-Control or Expires don't exist, but if the response includes an ETag header (which is another way to cache), Firefox will still cache it and reuse on next navigation, so you could ignore the error.
This part could be relevant
yeah I saw that
Does it happen when the cache is completely cleared?
yeah it does happen with the caching disabled
is there a way to make this work locally too?
You said you used SSR. Could you just try and add Cache-Control headers in the response and see if that fixes it? Astro.response.headers.set('Cache-Control', 'public, max-age=0')
Relevant from issue comment:
The issue is more prominent for SSR-ed pages because the server can't apply or assume any cache headers by default. You need to add them yourself.
alright trying something out
I tried adding the headers in my middleware
didn't seem to work though
the prefetch happening in the console
with the cache control header
the browser request still shows NS binding aborted and does not have the header I added
You can just add them on the page where you disabled prerendering with the code I posted above
I'm not sure if it works in middleware
also
i got it working
you need to add them to the response not the request
I'm trying to avoid adding it to every page
u need to set the max-age on something diffrent then 0 then it works
seems like there should be a better way
still, add it to the response, not the request
just add to the index.astro
I think he's got multiple SSR pages and doesn't want to add it everywhere manually
I have prefetched links on multiple pages
ah yess sorry i got just two
I would still add it to a single page first and check if it fixes that particular prefetch
That's good to know, but I guess it makes sense
Got it working in middleware, thanks for the help @ember monolith
Glad you managed to sort it 🙂