Rewrite to API backend
Unanswered
Black-headed Gull posted this in #help-forum
Black-headed GullOP
I have a backend API called mits that I'm trying to redirect users to but it appears that the version=z is being stripped when I get to my mits api.
In my mits api route:
If I hit the api endpoint directly via http://localhost:3000/api/mits?version=z, I get the version number but not when I hit http://localhost:3000/test-41-z.xml.
How can I get the query params after the rewrite?
return [
{
source: "/test-41.xml",
destination: "/api/mits"
},
{
source: "/test-41-z.xml",
destination: "/api/mits?version=z"
}
];
In my mits api route:
const version = request.nextUrl.searchParams.get( "version" );
If I hit the api endpoint directly via http://localhost:3000/api/mits?version=z, I get the version number but not when I hit http://localhost:3000/test-41-z.xml.
How can I get the query params after the rewrite?