-
-
Notifications
You must be signed in to change notification settings - Fork 17
BUGFIX: Redirect handler works with Neos in subdirectory #30
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
base: main
Are you sure you want to change the base?
Conversation
Using the RequestInformationHelper ensures that the baseUri includes the script request path (so any sub directory neos might be in).
@@ -107,7 +107,8 @@ protected function buildResponse(ServerRequestInterface $httpRequest, RedirectIn | |||
$location = $redirect->getTargetUriPath(); | |||
|
|||
if (parse_url($location, PHP_URL_SCHEME) === null) { | |||
$location = (string)$httpRequest->getUri()->withQuery('')->withFragment('')->withPath($location); | |||
$baseUriForRequest = (string)RequestInformationHelper::generateBaseUri($httpRequest); | |||
$location = rtrim($baseUriForRequest, '/') . '/' . ltrim($location, '/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't be better to assure, that the $baseUriForRequest got from that method always has / has not a trailing slash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, and actually that is the case. It always has a trailing slash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we be sure that location has (or has not) a leading slash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
targetUriPath
gets a ltrim
for slashes in it's constructor.
@kitsunet would this also work with the Neos 4.3 compatible 3.x branch? Then you could retarget the PR |
@kitsunet Can we close this? Or is this still relevant? |
@kitsunet Ping |
Using the RequestInformationHelper ensures that the baseUri includes the script request path (so any sub directory neos might be in).