Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http redirects not working with Fastify for Android Webviews #707

Open
nkshah2 opened this issue Oct 5, 2023 · 1 comment
Open

Http redirects not working with Fastify for Android Webviews #707

nkshah2 opened this issue Oct 5, 2023 · 1 comment

Comments

@nkshah2
Copy link
Contributor

nkshah2 commented Oct 5, 2023

The default API implementation for Apple redirect post includes the following code:

options.res.setHeader("Location", urlObj.toString(), false);
options.res.setStatusCode(303);
options.res.sendHTMLResponse("");

This way of redirecting does not work with Fastify (tested on Android webviews).

FastifyReply exposes a method called redirect that does work properly. A good way to solve this is to add another method to BaseResponse for redirection that can use framework default methods of doing redirects wherever possible.

All instances in code where we manually redirect should then also use this function

@nkshah2
Copy link
Contributor Author

nkshah2 commented Oct 6, 2023

For anyone following this issue, this has been added to the pipeline and will be prioritised if enough people run into this issue. In the meantime if you do run into this issue you can use the original FastifyReply object to redirect using their helper function by overriding the apple redirect API

Inside your override you can access the response object

options.res.original.redirect(url)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant