Skip to content

[9.x] Do not prepend baseUrl to absolute urls#41307

Merged
taylorotwell merged 2 commits into
laravel:9.xfrom
JaZo:feature/ignore-base-url-for-absolute-urls-non-breaking
Mar 3, 2022
Merged

[9.x] Do not prepend baseUrl to absolute urls#41307
taylorotwell merged 2 commits into
laravel:9.xfrom
JaZo:feature/ignore-base-url-for-absolute-urls-non-breaking

Conversation

@JaZo

@JaZo JaZo commented Mar 3, 2022

Copy link
Copy Markdown
Contributor

This is a non-breaking version of #41289.

Problem

I've created an HTTP macro to easily work with an API, just like the documentation suggests. The response of this API is paginated and the URL of the next page is returned in the response. This URL is absolute and making a request with a base URL and an absolute URL currently results in requests like https://api.github.com/https://api.github.com/organizations/laravel. Guzzle allows you to set a base URL and use absolute URL's in conjuction, so I'd expect this client to support that too.

Solution

Guzzle follows RFC 3986 to resolve the URL against the base URL, but implementing the same logic will be a breaking change, as described in #41289 (comment). This fix is more naive and will only fix the base URL + absolute URL issue.

@taylorotwell taylorotwell merged commit e7dc913 into laravel:9.x Mar 3, 2022
@JaZo JaZo deleted the feature/ignore-base-url-for-absolute-urls-non-breaking branch March 7, 2022 12:37
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