#I didn't buy cdn service, but it seems to be cached by cdn. It's too strange

35 messages · Page 1 of 1 (latest)

native pond
#

Hello,
I haven't purchased a CDN caching service, but why is my Next.js program's homepage automatically cached and cannot be updated? Even if the domain name points to another site, accessing that domain name still displays the previous page. Does anyone know the reason? I'm seeking to learn more.

native pond
#

who can help me thank you very much🥹

#

I have tried many methods, but they can't

kind iron
#

Are you using Cloudflare or Vercel? Caching on vercel is enable by default.

native pond
kind iron
#

Could you share a link to the page? And screenshot of the response headers?

native pond
kind iron
native pond
kind iron
#

What nextjs version are you using? are you using the /pages or /app dir?

kind iron
native pond
kind iron
#

no that is related to nextjs but there x-cache: HIT is

kind iron
#

i meant the initial route /

native pond
native pond
kind iron
#

do you have any dynamic data in there?

native pond
kind iron
#

try this

export async function getServerSideProps(context) {


context.res.setHeader(
        'Cache-Control',
        'public, s-maxage=10, stale-while-revalidate=59'
    )
native pond
native pond
#

@kind iron You can see the latest content through IP access, and the old content through domain name access. IP access address: http://47.111.15.161:3000

kind iron
#

that indicated a CDN has cached your stuff

#

the x-next-cache header might be cached too

#

in that case you need to clear the cache or disable it entirely on non-static directories

native pond
# native pond how to clear the cache🥹

I just logged in to the Alibaba Cloud background to check what the interface looks like if there are cdn settings. Can you give me a screenshot for reference? I can't find cdn in my resources, nor can I find any clues in the domain name resolution record

kind iron
native pond
kind iron
#

This is what is looks like in cloudflare