Hello,
I’ve read through the documentation around redirects and how Netlify automatically passes the query params to the forward url when redirecting, but what I can’t figure out is how to disable this behavior when the redirect comes from a Netlify Function and not through the _redirects
file or the netlify.toml
.
I’m using Auth0’s NextJS library and it has an auth flow as follows:
- User goes to
/api/auth/login
and is prompted to login - User is taken to
/api/auth/callback
with some query params for authentication (in this casecode
andstate
) - User is redirected (the Auth0 library uses
res.writeHead(302, { Location: 'myapp.netlify.app/' })
) - User lands on
myapp.netlify.app/?code=...&state=...
Netlify is deploying these /api/
endpoints as Netlify Functions.
Is there a way to disable Netlify’s query param forwarding for a specific set of urls or for Functions in general? The code
and state
params are only relevant for the /callback
endpoint and shouldn’t be maintained through the redirect.