Skip to content

Adding support for relative url redirects - #2

Closed
mcreale wants to merge 1 commit into
trunkcode:mainfrom
mcreale:main
Closed

mcreale wants to merge 1 commit into
trunkcode:mainfrom
mcreale:main

Conversation

@mcreale

@mcreale mcreale commented Nov 7, 2023

Copy link
Copy Markdown

This PR adds support for relative URL redirects. if a relative url is found it will assume that we are using the current protocol and host name.

Improving redirect logic to follow relative urls
@samiahmedsiddiqui samiahmedsiddiqui mentioned this pull request Oct 2, 2026
@samiahmedsiddiqui

Copy link
Copy Markdown
Contributor

Thanks for the fix, @mcreale, and sorry it took so long to get back to you.

v2 is a complete rewrite, and lib/check-status-code.js no longer exists, so this PR can't be merged as it is. The relative redirect problem it addresses is fixed in v2 (#3). Every Location header is now resolved against the current URL, which covers /path, page, ../page and //host/path, and keeps non-default ports. The fix is covered by tests.

I'll close this once #3 is merged and v2.0.0 is released. Thanks again for reporting it and sending a fix!

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

Successfully merging this pull request may close these issues.

2 participants