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

Resolve API url generation issues for subdirectory installs. #204

Merged
merged 1 commit into from Jun 30, 2018
Merged

Resolve API url generation issues for subdirectory installs. #204

merged 1 commit into from Jun 30, 2018

Conversation

ghost
Copy link

@ghost ghost commented Jun 29, 2018

Concatenating $request->getSchemeAndHttpHost() with $request->getBaseUrl() generates the correct URLs for subdirectory installs. I have tested this works with a Laravel 5.4 installation in both the root directory and a subdirectory.

@lindyhopchris
Copy link
Member

@thompsonsj thanks for this, I need to look into how Symfony calculates the base URL and add tests before merging. Just leaving work now so don't have time to look into the code. Is this something you set on the Symfony request for your sub directory installs?

@ghost
Copy link
Author

ghost commented Jun 29, 2018

No problem!

The getBaseUrl method is available on the same $request object that you call getSchemeAndHttpHost on. It is a Symfony method.

Symfony\Component\HttpFoundation\Request::getBaseUrl

I refer to docs for the 3.2 branch of Symfony that is installed with my Laravel 5.4 installation.

https://api.symfony.com/3.2/Symfony/Component/HttpFoundation/Request.html#method_getBaseUrl
https://api.symfony.com/3.2/Symfony/Component/HttpFoundation/Request.html#method_getSchemeAndHttpHost

@lindyhopchris lindyhopchris changed the base branch from master to develop June 30, 2018 06:45
@lindyhopchris lindyhopchris changed the base branch from develop to master June 30, 2018 06:54
@lindyhopchris lindyhopchris merged commit dd7f9b1 into cloudcreativity:master Jun 30, 2018
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.

1 participant