Have the UI hosted on example.com and backend hosted on api.example.com In a specific OAuth scenario api.example.com returns a 404 for this url
https://api.example.com/ng/login?error=access_denied&state=bQ9lk2#
I would like to handle this 404 in nginx and redirect it to
https://example.com/ng/login?error=access_denied&state=bQ9lk2#
[without the api subdomain]
How do I do this preserving the query params