tuupola / slim-jwt-auth

PSR-7 and PSR-15 JWT Authentication Middleware
https://appelsiini.net/projects/slim-jwt-auth
MIT License
829 stars 142 forks source link

Slim 4 - setBasePath is not taken into account #178

Open Misiu opened 4 years ago

Misiu commented 4 years ago

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 commented 4 years ago

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

tuupola commented 4 years ago

Apparently this is expected behaviour with Slim 4: https://github.com/slimphp/Slim/issues/2898. I will think about possible workarounds.

l0gicgate commented 4 years ago

@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 commented 4 years ago

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