Redirecting instead of rewrite

We have 2 sites hosted within vercel using next.js and a monorepo

next.config has rewrites setup

rewrites: () => {
		const rewrites = [];
		if (process.env.NEXT_PUBLIC_SITE === "sitea") {
			rewrites.push({
				source: "/siteb{/}?",
				destination: "https://siteb.vercel.app",
			});
			rewrites.push({
				source: "/siteb/:path*",
				destination: "https://siteb.vercel.app/:path*",
			});
			rewrites.push({
				source: "/testing{/}?",
				destination: `https://example.com/`,
			});
		}
		
		return {
			beforeFiles: rewrites,
		}
	},

This was all working as expected
user visits https://example.com/ and sees sitea
user visits https://example.com/siteb/ and sees siteb without being redirected

recently however if
user visits https://example.com/siteb/ they are being 308 redirected to https://siteb.vercel.app/ which is not the intended behaviour

for testing i’ve added another rewrite to a url not hosted on vercel and can see that working as expected.

Thanks for reporting this. Our engineering team is currently investigating.

It looks like you also have a support case open with our customer success team. They’ll share updates there as soon as new details are available.

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