Closed rwilliams3088 closed 4 months ago
Maybe just use cache: default
and let the browser figure it out. The list is already returned with cache-control: public,max-age=86400
.
I'm not entirely sure, but I don't think using the request header works. If you're making the request you are downloading a new list anyway. It might just affect caches on the way.
Upon re-testing, removing the Cache-Control Header, it does look like the browser is properly caching the document and loading from the cache for subsequent GET requests :) Not sure what I was doing wrong previously - because it didn't look like it was caching then.. but looks like its all working as expected. Thanks!
I want to use the Public Suffix List on my front-end to parse hostnames and properly determine what the subdomains are in a generic but robust fashion. I also want to respect the request to not overload the server with GET requests, but to restrict the requests to every 24 hours or so.
However, if I attempt to set the Cache-control header to
max-age=86400
then I get a CORs error; it would seem that the Cache-Control header is not permitted. If I remove this header, then Firefox uses the "no-cache" option instead....I'm thinking long-term I'll use my server to cache a copy of the file and then have the front-end request it from my server rather than directly from
https://publicsuffix.org/list/public_suffix_list.dat
. However, I wanted to bring your attention to it in case you want to fix it, or else if you can provide guidance on how to request the file via javascript with caching.