Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Slim 4 - setBasePath is not taken into account #178

Open
Misiu opened this issue Dec 5, 2019 · 4 comments
Open

Slim 4 - setBasePath is not taken into account #178

Misiu opened this issue Dec 5, 2019 · 4 comments
Assignees

Comments

@Misiu
Copy link

Misiu commented Dec 5, 2019

I have Slim 4 app that is deployed into a subfolder and called like so: https://subdomain.example.com/api/foo

Inside my code I have this line:
$app->setBasePath("/api");

According to the docs path and ignore shouldn't include basepath. But this doesn't work:

"path" => "/",
"ignore" => ["/foo"],

After adding basepath like below the code works:

"path" => "/api",
"ignore" => ["/api/foo"],

There are some differences between Slim 3 and Slim 4 according to @tuupola comment here

@tuupola tuupola self-assigned this Dec 5, 2019
@tuupola
Copy link
Owner

tuupola commented Dec 12, 2019

Here is a test showing the differences: https://github.com/tuupola/slim-basepath

@tuupola
Copy link
Owner

tuupola commented Dec 13, 2019

Apparently this is expected behaviour with Slim 4: slimphp/Slim#2898. I will think about possible workarounds.

@l0gicgate
Copy link

@tuupola I think it's worth mentioning that this is the behavior of the PSR-7 implementation itself, not Slim 4 per se. So far as per your tests Slim-Psr7 and Nyholm/Psr7 have the same behavior. I'm not sure about Guzzle and Zend though.

@tuupola
Copy link
Owner

tuupola commented Dec 15, 2019

True, I will also test with Expressive to see how it works.

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

No branches or pull requests

3 participants