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

Missing redirects in legacy routing mode with empty URL suffix #3382

Closed
fritzmg opened this issue Aug 25, 2021 · 22 comments
Closed

Missing redirects in legacy routing mode with empty URL suffix #3382

fritzmg opened this issue Aug 25, 2021 · 22 comments
Assignees
Labels
Milestone

Comments

@fritzmg
Copy link
Contributor

fritzmg commented Aug 25, 2021

Affected version(s)

Contao 4.11, 4.12

Description

If you configured contao.prepend_locale = true and contao.url_suffix = '' under Contao 4.9, the following redirects would happen:

Initial URL Location response header Result
example.com/de example.com/de/ Shows index page of de website tree.
example.com/exists example.com/en/exists Shows exists page of en website tree.
example.com/does-not-exist example.com/xx/does-not-exist Shows 404 page of the respective website tree (depending on Accept-Language).

However, under Contao 4.11.9, 4.12 with legay routing not disabled the following happens:

Initial URL Location response header Result
example.com/de - Shows Symfony 404 page.
exapmle.com/exists example.com/en/exists Shows exists page of en website tree.
example.com/does-not-exist - Shows Symfony 404 page.

At least the non-trailing slash language URL not redirecting (and showing the Symfony 404 page instead) should not be happening with legacy_routing enabled.

With contao.legacy_routing = false the following happens under Contao 4.12:

Initial URL Location response header Result
example.com/de example.com/de/ Shows index page of de website tree.
exapmle.com/exists example.com/en/exists Shows exists page of en website tree.
example.com/does-not-exist - Shows Symfony 404 page.

The latter redirect not happening is intended, iirc?

/cc @aschempp

@fritzmg fritzmg added the bug label Aug 25, 2021
@fritzmg fritzmg added this to the 4.12 milestone Aug 25, 2021
@leofeyer
Copy link
Member

  • The missing example.com/deexample.com/de/ redirect with legacy routing enabled is wrong IMHO.
  • The example.com/does-not-existexample.com/xx/does-not-exist redirect has been dropped intentionally IIRC.
  • The request example.com/does-not-exist not being redirected is correct and intended.

@jxns
Copy link

jxns commented Aug 25, 2021

The example.com/does-not-exist → example.com/xx/does-not-exist redirect has been dropped intentionally IIRC.
The request example.com/does-not-exist not being redirected is correct and intended.

Is there a particular reason for this? I think it is very inconvenient that there is no redirect in this case.

@leofeyer
Copy link
Member

Because example.com/does-not-exist is a valid URL if the URL suffix is empty and invalid (404) if the URL suffix is /. Likewise, example.com/does-not-exist/ is a valid URL if the URL suffix is / and invalid if the URL suffix is empty.

@jxns
Copy link

jxns commented Aug 25, 2021

But is this:

The example.com/does-not-exist → example.com/xx/does-not-exist redirect has been dropped intentionally IIRC.

configurable?
Because I have two different installations (both running on 4.11.8). One installation where the redirect is working and one installation where I get an 404 response instead.

@leofeyer
Copy link
Member

@aschempp /cc

@ausi
Copy link
Member

ausi commented Aug 25, 2021

One installation where the redirect is working

By working you mean you get a redirect to example.com/xx/does-not-exist that still results in a 404 page, right?

@jxns
Copy link

jxns commented Aug 25, 2021

By working you mean you get a redirect to example.com/xx/does-not-exist that still results in a 404 page, right?

I get a successful redirect from example.com/does-not-exist to example.com/xx/does-not-exist.
("does-not-exist" is a valid and existing subpage. Just to avoid any misunderstandings).

@fritzmg
Copy link
Contributor Author

fritzmg commented Aug 25, 2021

In my examples does-not-exist is representative of page aliases that do not exist in the site structure. I have not tested the case for ones that do.

// I have added an exists example. Note however, that in my testing a page with the alias exists exists in all website roots.

@asaage
Copy link

asaage commented Aug 25, 2021

again and again issues with empty suffix and folder urls...
#2775
#2812
now with prepend_locale in the mix 😵

@fritzmg
Copy link
Contributor Author

fritzmg commented Aug 25, 2021

The redirect from example.com/de to example.com/de/ in Contao 4.12 does indeed work, if the contao.url_suffix is non-empty.

@fritzmg fritzmg changed the title Missing redirects in legacy routing mode Missing redirects in legacy routing mode with empty URL suffix Aug 25, 2021
@jxns
Copy link

jxns commented Aug 25, 2021

In my case, example.com/exists still does not redirect to example.com/de/exists.
Where you able to reproduce this as well?

@fritzmg
Copy link
Contributor Author

fritzmg commented Aug 25, 2021

No, I was not able to reproduce that. How many website roots and for which languages do you have, and in which website roots does a page with the alias exists exist? And what is the Accept-Language of your browser?

@jxns
Copy link

jxns commented Aug 25, 2021

I have two website roots. One for de and one for en.
My Accept-Language is:
accept-language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
The direct is not working on only one of my pages. It is working on other Contao installations (all running on 4.11.8)

@fritzmg
Copy link
Contributor Author

fritzmg commented Aug 25, 2021

The direct is not working on only one of my pages. It is working on other Contao installations (all running on 4.11.8)

Is this page present with the same alias in both roots?

@jxns
Copy link

jxns commented Aug 25, 2021

Yes, the page is present in both languages with the same alias.

@fritzmg
Copy link
Contributor Author

fritzmg commented Aug 25, 2021

The fact that it is not working seems specific to your Contao instance then may be. I cannot reproduce this.

@aschempp
Copy link
Member

@fritzmg would you be able to create some failing functional tests for the explained use cases?

@jxns
Copy link

jxns commented Aug 25, 2021

@fritzmg So what could cause this error? What would you suggest on how to troubleshoot?

@asaage
Copy link

asaage commented Aug 25, 2021

The fact that it is not working seems specific to your Contao instance then may be. I cannot reproduce this.

It might be worth to investigate if apache vs nginx have different behaviour in regards of trailing slashes. At least that was what i was encountering some years ago. May be it's just a webserver-config thing.

@jxns
Copy link

jxns commented Aug 26, 2021

In my case, example.com/exists still does not redirect to example.com/de/exists.

Okay, I have found at least two of my contao installations, where this occurs. What could cause this behaviour?

@aschempp aschempp self-assigned this Aug 26, 2021
@leofeyer
Copy link
Member

@fritzmg Does the issue occur in Contao 4.13, too? If so, please reassign the milestone.

@jxns
Copy link

jxns commented Feb 21, 2022

The issue seems to be solved in 4.13. Thank you :-)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants