Next.js Discord

Discord Forum

DNS Cache Error

Unanswered
Mostlyk posted this in #help-forum
Open in Discord
Hey so we have a domain, and we hosted a next site using vercel on that domain , ( we bought the domain from godaddy). And now because a lot of our users have already visited that site, we have deployed a new site and the users still see the old site. We can't ask everyone to clear cache on their devices. What can we do here?

116 Replies

and yes we already have added:

  async headers() {
    return [
      {
        source: "/", 
        headers: [
          {
            key: "Cache-Control",
            value: "no-cache, no-store, must-revalidate",
          },
          {
            key: "Pragma",
            value: "no-cache",
          },
          {
            key: "Expires",
            value: "0",
          },
        ],
      },
      {
        source: "/_next/static/(.*)", 
        headers: [
          {
            key: "Cache-Control",
            value: "public, max-age=31536000, immutable",
          },
        ],
      },
    ];
  },
@B33fb0n3 depending on where you are configuring your DNS you can see there the TTL. That says how long it's inside the DNS cache in minutes. So set it low and your DNS won't be the problem anymore
yeah that's 1 hour on everything, we have deployed the site 3-4 days ago and it's still persistent, the users still see the old CSS,HTML
cached view
how it's supposed to look
I have kept cache on this browser for me to check
did you redeployed your app on vercel? I getting a cache hit from vercel
@B33fb0n3 did you redeployed your app on vercel? I getting a cache hit from vercel
yeah? like it was initially deployed on vercel from a different account on a different repo
:this_is_fine: sorry if this doesn't come under next.js server
and the number for stale time is at 4294967294. For vercel that's an infinite time of cache:
hmmm so how do I make changes?
Should your page be static?
wait so you haven't even visited the prev site, are you able to see it?
@B33fb0n3 Should your page be static?
preferably no
@Mostlyk wait so you haven't even visited the prev site, are you able to see it?
I see this one
every page is static except /profile
@B33fb0n3 I see this one
yeah this is the new one
this we are fine with vercel storing cache
@Mostlyk preferably no
then add the following on top of your page:
export const dynamic = 'force-dynamic';
export const revalidate = true;
our users see
@B33fb0n3 then add the following on top of your page: tsx export const dynamic = 'force-dynamic'; export const revalidate = true;
revalidate = 60 is what I kept, gonna check now , thanks for the help!
it's building
🀞
Also do you know a better way to save 100 Gb bandwidth vercel offers?
We had issues last time as it finished relativitly quickly
@B33fb0n3 then add the following on top of your page: tsx export const dynamic = 'force-dynamic'; export const revalidate = true;
btw issue still persists after this. Current deployment has this :(
@Mostlyk Also do you know a better way to save 100 Gb bandwidth vercel offers? We had issues last time as it finished relativitly quickly
let's focus on this issue first. Remind me at the end of this thread about that
@Mostlyk btw issue still persists after this. Current deployment has this :(
it looks like it's still not dynamic yet: (see attached).
Can you remove your header overwrites, so we can check easier why the error persists?
Also take a look inside the build log. What's the icon of your page?
@Mostlyk you mean this right?
That for example, yea. Maybe you have some other overwrites anywhere as well. Maybe via cloudflare or something else
ummm could it be that camp.iicpc.com might be affecting that?
it still should show old site?
because that's still has the same domain? and uses the cache?
idk I am not really familiar with how DNS works actually
@Mostlyk it still should show old site?
when you (you as person) refresh the page, do you get anywhere the old version? Than we can take a look at the headers as well
yes yes camp.iicpc.com should show the old version
@Mostlyk idk I am not really familiar with how DNS works actually
it's not an DNS cache issue. The DNS cache is for everybody the same. So when you get it, I would get it too. But I get the new version. So It's not about the DNS cache
I think we should buy another domain for old version
@Mostlyk yes yes camp.iicpc.com should show the old version
hmm camp.iicpc.com is not reachable for me (DNS_PROBE_POSSIBLE) πŸ€”
@Mostlyk I think we should buy another domain for old version
you can add unlimited subdomains to your own domain
oh yes , I did reset DNS today and that is also showing the cached site onli
only*
yup it's unreachable if it's not cached
@B33fb0n3 Also take a look inside the build log. What's the icon of your page?
/favicon.ico it's in public folder
and also removed headers
it's deploying without the headers I added earlier
@Mostlyk /favicon.ico it's in public folder
what's the icon for the / route?
@B33fb0n3 what's the icon for the / route?
I have kept
        <link rel="icon" href="/favicon.ico" />
on layout
removed headers btw
deployed
@Mostlyk I have kept <link rel="icon" href="/favicon.ico" />
no, I mean inside your build log. The icon in front of your route. Not the favicon
@Mostlyk Click to see attachment
this is from the newest deployment?
hmm it looks like your page is still static πŸ€”
@Mostlyk Do you have a person that get the "old version", when he refreshes the page (maybe even yourself)?
yes I do
I have it in my brave browser
great. Open that page and open the dev tools. Go into your network tab. DONT set the checkmark at "disable cache" (as your customers wouldn't as well).

Now refresh the page. You now see a lot of requests. Open the first one. And send a screenshot of all the response headers
hmm i have noticed something , we had this in old site, what If we add it in the new one
no requests :(
wait mb
i am stupid
@Mostlyk no requests :(
remove your filter
i am searching
😭 no cache but 302 is wild , i have never dealt with this stuff, as an undergrad it's confusing
@Mostlyk Click to see attachment
can you visit your GSE server and invalidate their cache?
umm I did go to search.google.com and ask for a recrawl
Are you sure you are on the correct page? As in the request there is a search param but in your url there isn't. The request is 100% managed by the client...
@Mostlyk umm I did go to search.google.com and ask for a recrawl
You mean the search console from google?
so we are using godaddy's domain
@Mostlyk yeah I am refreshing this page
Are you sure? If a search param is inside your request for the inital page it normally is in the url as well πŸ€”
@B33fb0n3 Are you sure? If a search param is inside your request for the inital page it normally is in the url as well πŸ€”
yeas , yeah you are absolutely right idk why it's not showing there, other request are the api calls we are making to ibb.com so it's pointless for those
@Mostlyk yeah
yea, then invalidate their cache. Google search Console normally has nothing to do with caching and server. But maybe you hosted your page via google servers before
@Mostlyk It looks like your old version was deployed using the google cloud. Make sure you invalidate the cache there
@B33fb0n3 yea, then invalidate their cache. Google search Console normally has nothing to do with caching and server. But maybe you hosted your page via google servers before
I am pretty sure we never used google per say, we deployed via vercel on the domain we bought from godaddy
I will still ask the team who worked on the old version tho
Thanks!
@Mostlyk I am pretty sure we never used google per say, we deployed via vercel on the domain we bought from godaddy
GSE = Google Servlet Engine. And when searching for that you can see it's likely used when deploying via google cloud. Make sure the cache there is invalidated and then the new page will also be visible
yup will see this
@Mostlyk yup will see this
Update this thread when you got a response
@B33fb0n3 Update this thread when you got a response
yes sure, thanks for the help!
@Mostlyk any update?
@B33fb0n3 <@1114939504999018556> any update?
Nope , I will update the thread asap if I get it
@B33fb0n3 <@1114939504999018556> any update?
So no the prev team didn't use GSE..
@Mostlyk So no the prev team didn't use GSE..
how does the "Server: GSE" appears inside your Response Header?

Like the response headers are set by the server that handled the request. And the server said: "I am GSE" (Google Servlet Engine). How does this happen?
@Mostlyk ?
@B33fb0n3 <@1114939504999018556> ?
Hey super sorry about not being responsive for the past couple of days, I had my academics on a roll.
@B33fb0n3 how does the "Server: GSE" appears inside your **Response Header**? Like the *response headers* are set by the server that handled the request. And the server said: "I am GSE" (Google Servlet Engine). How does this happen?
So regarding this, I am still finding other people who are seeing the cached website and checkin their headers because could it be that that specific header is from a different cache file in my local computer?
Because we didn't use GSE
Only thing we used was Vercel Analytics which prolly doesn't use GSE
@Mostlyk So regarding this, I am still finding other people who are seeing the cached website and checkin their headers because could it be that that specific header is from a different cache file in my local computer?
even if that would be the case, then you would also see a different website. But you are seeing the correct website and the header is bound to that. So I don't think that's the case
@Mostlyk yeah, we had a gooogle form script, I am also removing that from google account or lookign ways to do that
in your case the whole page was served from a google server. And this google server still serves the cached version to your other customers. So when you delete that cache, the new version will be served
the script that was loading/ getting requested to has the same url as our google forms script
so I assume deleting/ removing that link would perhaps solve the issue right?
I deleted the script but the cache is still persistent
@Mostlyk nah, the server that served that page (something from google) most be revalidated. Else it will still serve it
@Mostlyk we didn't use google to serve ever
hmm ok. What's the Server: GSE inside the header then?
@Mostlyk ?
@B33fb0n3 hmm ok. What's the Server: GSE inside the header then?
yeah I am not sure either, it's still there even after deleting the script
I guess there must be no way to fix it as it's in the user's computer
Yea, the solution would be to invalidate the cache from the GSE server