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

Getting wrong header location in https response(redirecting) #890

Closed
Kumar-Patil opened this issue May 4, 2016 · 2 comments
Closed

Getting wrong header location in https response(redirecting) #890

Kumar-Patil opened this issue May 4, 2016 · 2 comments
Labels

Comments

@Kumar-Patil
Copy link

Kumar-Patil commented May 4, 2016

Hi All,
I am new to luvit, Please help me to resolve below issues.

step 1 : i will request url as https://premium.boundary.com
and i will get response status code as 301 and in response headers(res.headers.location) i will get url as (https://pulse.truesight.bmc.com/) and it is correct.

step 2 : I will request URL as (https://pulse.truesight.bmc.com/) and in response headers(res.headers.location) i will get (/home) . It should automatically redirect to (https://pulse.truesight.bmc.com/home) this url.

Please help me to resolve redirecting issues. If some one already faced same issue. Please share your inputs.

---Even i have checked in java it works perfectly (redirecting).
--Please share information to info.patil87@gmail.com

@squeek502
Copy link
Member

Seems like you probably need url.resolve from the node.js API, which is currently missing from Luvit.

  • url.resolve("https://premium.boundary.com", "https://pulse.truesight.bmc.com/") would give you "https://pulse.truesight.bmc.com/"
  • url.resolve("https://pulse.truesight.bmc.com/", "/home") would give you "https://pulse.truesight.bmc.com/home"

@creationix
Copy link
Member

creationix commented May 4, 2016

Automatic redirect is not supported in node.js core and the core luvit http library follows the node.js API.

What people typically do in node is use a userspace library like request that has a higher abstraction including automatic redirect.

And yes, as @squeek502 has said, Location headers need to be resolved against the current url to get the new full absolute url.

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

No branches or pull requests

4 participants