-
Notifications
You must be signed in to change notification settings - Fork 93
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
Allow passthrough redirects #125
Conversation
@@ -31,6 +31,10 @@ function waitConnection (socket, write) { | |||
} | |||
} | |||
|
|||
function isExternalUrl (url = '') { | |||
return urlPattern.test(url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind to check if url.startsWith('http://') || url.startsWith('https://')
is faster than regex?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Awesome, happy new year @mcollina. Waiting for this one getting merged :D |
@@ -31,6 +31,10 @@ function waitConnection (socket, write) { | |||
} | |||
} | |||
|
|||
function isExternalUrl (url = '') { | |||
return urlPattern.test(url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this guaranteed to be "an external url"? Shouldn't the headers be inspected to determine if there is a 3xx
code that should be honored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my initial thought but status code
is not getting passed through the rewriteHeaders
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I would think the solution starts with resolving that issue. I do not see how this simple test is a guarantee of a redirect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If status code
is necessary for the checking, I think you can start a PR in fastify-reply-form
to achieve it.
any updates on this? |
I am not sure I can merge this one as there are no action items, I resolved all the issues but merging is blocked and I don't know why. |
Merging is not blocked, per se. I would certainly like my question addressed, but I'm not blocking this. |
@vorillaz could you try merging this again if nothing is blocking? |
Description
Allow absolute URL redirects when applicable. Closes #124 .
Checklist
npm run test
andnpm run benchmark
and the Code of conduct