#Firefox prefetching NS_BINDING_ABORTED

1 messages · Page 1 of 1 (latest)

wheat bison
#

I setup it up like in the docs
In chrome its does work fine but in firefox i get this errorNS_BINDING_ABORTED

Docs

Prefetch links for snappier navigation between pages.

dusky galleon
#

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

outer cobalt
#

cc @dawn sable who might have thoughts
Otherwise would appreciate an issue with a reproduction!

cloud pendantBOT
#

Oof. Let's get this bug fixed.

Please open an issue on the withastro/astro repo.

dusky galleon
dusky galleon
#

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 ❤️

wheat bison
#

When i access the project over stackblitz the prefetching does work but when im running the project locally it does not work

ember monolith
#

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

dusky galleon
#

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

ember monolith
#

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

dusky galleon
#

yeah I saw that

ember monolith
#

Does it happen when the cache is completely cleared?

dusky galleon
#

yeah it does happen with the caching disabled

wheat bison
#

is there a way to make this work locally too?

ember monolith
#

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.

dusky galleon
#

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

ember monolith
#

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

wheat bison
#

i got it working

ember monolith
#

you need to add them to the response not the request

dusky galleon
wheat bison
#

u need to set the max-age on something diffrent then 0 then it works

dusky galleon
#

seems like there should be a better way

ember monolith
wheat bison
ember monolith
dusky galleon
wheat bison
#

ah yess sorry i got just two

ember monolith
#

I would still add it to a single page first and check if it fixes that particular prefetch

ember monolith
dusky galleon
#

Got it working in middleware, thanks for the help @ember monolith

ember monolith