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

The App overrides static basePath on the router #2367

Closed
morozov opened this issue Dec 13, 2017 · 2 comments
Closed

The App overrides static basePath on the router #2367

morozov opened this issue Dec 13, 2017 · 2 comments

Comments

@morozov
Copy link

morozov commented Dec 13, 2017

When a Slim application works behind a reverse proxy and generates absolute URLs, it generates them according to the internal web server hostname and port, not the external ones. Even if the base path is statically defined in container configuration, it gets overridden during request processing:

Slim/Slim/App.php

Lines 340 to 342 in 3ab1a15

if (is_callable([$request->getUri(), 'getBasePath']) && is_callable([$router, 'setBasePath'])) {
$router->setBasePath($request->getUri()->getBasePath());
}

Currently, it's only possible to override this behavior by introducing a middleware which kicks in after App::process() and restores the needed base path.

It would be nice if the App only set the base path if it's not set yet.

@geggleto
Copy link
Member

I don't think we will be fixing this in v3... but we will probably address this in v4.

@morozov
Copy link
Author

morozov commented Apr 26, 2019

Should this be reopened for Slim 4? From the DX perspective, it looks like a bug while the described approach is more of a workaround, not a recommended solution.

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

No branches or pull requests

2 participants