Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kitsunet
Copy link
Member

@kitsunet kitsunet commented Sep 6, 2019

Using the RequestInformationHelper ensures that the baseUri includes the script request path (so any sub directory neos might be in).

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
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, '/');
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member Author

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?

Copy link
Member

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.

@Sebobo
Copy link
Member

Sebobo commented Sep 25, 2019

@kitsunet would this also work with the Neos 4.3 compatible 3.x branch? Then you could retarget the PR

@dlubitz
Copy link
Contributor

dlubitz commented Apr 7, 2025

@kitsunet Can we close this? Or is this still relevant?

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.

None yet

4 participants