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

Relative Location Header #77

Closed
TheSharpieOne opened this issue Nov 6, 2018 · 2 comments
Closed

Relative Location Header #77

TheSharpieOne opened this issue Nov 6, 2018 · 2 comments

Comments

@TheSharpieOne
Copy link
Collaborator

Currently the location header returned in the response (which indicates to poll) expects a fully qualified URL (or absolute URL). Per the HTTP spec, a relative URL can be provided and should be supported

getLocation(response) {
let location = false;
if (response.config.getHeader) {
location = response.config.getHeader(response, 'Location');
} else {
location = response.headers.location || response.headers.Location;
}
return location;
}

The library should check for relative URLs and return a fully qualified URL to be polled.

@KaseyPowers
Copy link
Contributor

Wouldn't a relative URL given here be treated the same as the relative URLs we generate for the initial call?

Is this the reason we have this in our ms api definition?

@TheSharpieOne
Copy link
Collaborator Author

TheSharpieOne commented Feb 7, 2019

When we get back a relative url in the location header, such as abcdefg, we make a request to that url as if it was relative to the current path/page when it should be based on the original request url.
Example:
Current page: /current/browser/page
Original API: /api/v1/uploads/resumeable/
Response Location header: abcdefg

Where it currently polls: /current/browser/abcdefg
Where it should poll: /api/v1/uploads/resumeable/abcdefg

For microservices, we (for some reason) just use the same url no matter what the location header is IIRC.

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

2 participants