Okay even some more information to share, in case someone else has a similar problem. Turns out that netlify modified the etags here, adding a “df”-tag because it was compressed. This might be related to this past topic (Excessive Bandwidth Usage - #17 by luke).
To explain further.
On initial request, my function returns with pdf and an etag like this;
f1bdb37a0c7bb8e30e745721c9d36d38-ssl
It seems that netlify decides to compress it, and then changes the etag to:
f1bdb37a0c7bb8e30e745721c9d36d38-ssl-df
Now, the browser/cach send an IF-NONE-MATCH header with that etag. But my script isn’t smart enough to realize the equivalence (yet). All I need to do is change the logic here
And I suppose I have to figure out what etag the function should give in the response. Probably the same as the one in the reasponse…