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

Fix GoneDocumentSubscriber by passing sourceHost to RedirectRouteManager #72

Merged
merged 1 commit into from
Apr 30, 2021

Conversation

niklasnatter
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets fixes #71
License MIT

Why?

See #71

@niklasnatter niklasnatter force-pushed the bugfix/gone-source-host branch from 078945f to d5b52d4 Compare April 30, 2021 07:51
$this->redirectRouteManager->saveByData(['source' => $url, 'statusCode' => 410, 'enabled' => true, 'target' => '']);
$this->redirectRouteManager->saveByData([
'source' => $url,
'sourceHost' => null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we need to set the webspace domain for pages aslong as there is no {host} replacer set. Else if I have a page /test in 2 webspaces and remove both it should redirect to the correct domain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could I get the correct domain? I think there could be multiple configured domains for a single webspace, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But not sure if we need to be strict here. I think the worst thing that can happen is that we return a 410 in a webspace that never had a page on that URL, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 possibilities:

A. we create a redirect for every configured domain for the current environment
B. create a redirect only for the main / first domain found in the webspace config for the current environment

For me both is okay.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already generate all urls here

$url = parse_url($url, PHP_URL_PATH);
but parsing away the domain

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But not sure if we need to be strict here. I think the worst thing that can happen is that we return a 410 in a webspace that never had a page on that URL, right?

🤔 thats correct maybe we stay with this solution currently then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! But how can I find out if there was a {host} replacer in the URL? 🙈

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think thats not longer possible as we don't have a method for it 🤔

@alexander-schranz alexander-schranz merged commit 2345e8b into sulu:2.x Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting a Page fails if "Gone on remove" is enabled
2 participants