CDN routing

Hello. We are currently evaluating NextJS. Our current site is a PHP backend with Fastly CDN sitting in front.

With Fastly we have VCL to rewrite certain URLs to a different backend such as S3. An example:

if (req.http.host == "somehost" && req.url ~ "^/somepath") {
  set req.backend = F_s3;
  set req.http.host = "somehost";
  unset req.http.Authorization;
  unset req.http.Cookie;
  return(lookup);
}

Is it possible to do the same with Vercel? From my understanding, we’d no longer be able to use Fastly because our domain will be pointed to Vercel instead. Thanks

Hi @myles-totalmerchan, welcome to the Vercel Community!

Yes. Vercel supports rewrites and redirects and you should be able to do it with Next.js.

You can also use the Edge Middleware, which is the best and fastest way to do this.

I hope this answers your question. Let me know if I can help more.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.