I receive <Code>AccessDenied</Code> error when I try to reach a resource on XDN project

My page has been setup as proxied requests to the upstream site

When I try to reach any recourse from this page, I receive the error:

<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>DCE4F5BE0F4EABA0</RequestId>
<HostId>Pg5tDRZRKv1+KVYJC3m41PUVqXGhvNL01t+dzRcXAVEk56sbBlc2b4ePDTgINuKFW39+JtUTJhw=</HostId>
</Error>

Is problem on origin side or XDN side?

There was a similar error posted here: Receiving 404 "Access Denied" error on edge, but responds with 200 on serverless

See if that helps.

Hey Andrew,

Could you post the relevant bits of your router (are you using any of @xdn/ packages?) and the path to the resource? If there is any sensitive data please DM it to me.

Cheers,
Ivan

@ierceg

I think I found what is going on here.

I have rule that sending everything with _next/static to XDN

  .match("/_next/static/:path*", ({ cache, serveStatic }) => {
    cache(staticAssets);
    serveStatic(".next/static/:path*");
  })

But proxied page requests resources from the upstream.

TL/DR:
In this particular case this error is XDN error that requested resource has not been found.

As first step check router’s rules, probably it references this static asset and sends everything to XDN instead of the upstream site.

1 Like

Ok, glad to hear you solved it. Also note that our @xdn/next package, if added through .use, will also insert a route for '/_next/static/:path*' pointing to the static backend. If you need to work around this, before .use rule add your own rule for '/_next/static/:path*' and route those requests to origin.

1 Like