? Pending

User tests: Successful: Unsuccessful:

avatar andrepereiradasilva
andrepereiradasilva
19 Jul 2016

Pull Request for Issue #11165.

Summary of Changes

This PR reviews the HTTP status code of the redirects in the language filter plugins (current all are non cached 301 Moved Permanently).

After this PR the behaviour is the following:

  • /defaultlang* to /* (remove language code is set to Yes) = 301 Moved Permanently
  • /* to /defaultlang* (remove language code is set to No) = 301 Moved Permanently (not cached)
  • /* to /otherlang* (cookie language based redirect) = 302 Found

Testing Instructions

  1. Use latest staging
  2. Apply patch
  3. Test in a multilanguage site the behaviour described above by testing all combinations in global config (SEF / non SEF / etc) and language filter plugin parameters.
  4. Do a code review

More info

See discussion in #11196

avatar andrepereiradasilva andrepereiradasilva - open - 19 Jul 2016
avatar andrepereiradasilva andrepereiradasilva - change - 19 Jul 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 19 Jul 2016
Labels Added: ?
avatar andrepereiradasilva andrepereiradasilva - change - 19 Jul 2016
The description was changed
avatar mbabker
mbabker - comment - 19 Jul 2016

What's the benefit to not caching the second scenario? Something in my gut tells me this isn't the most optimal behavior.

avatar ggppdk
ggppdk - comment - 19 Jul 2016

Works:

Remove default language CODE : No (language filter plugin)
code_on

Remove default language CODE : Yes (language filter plugin)
code_off

All redirections that do not involve default language get a 302 code

avatar ggppdk ggppdk - test_item - 19 Jul 2016 - Tested successfully
avatar ggppdk
ggppdk - comment - 19 Jul 2016

I have tested this item successfully on 38b92ae

See my above comment


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11206.

avatar ggppdk
ggppdk - comment - 19 Jul 2016

@mbabker

no, we can not allow any redirection to be cached, that is what we fixed recently

e.g. using language code in the URL for default language

  • user visits homepage URL with no language code (thus user does not have language cookie yet), the user is redirected to home page with language code and gets 301 code, informing browser / search engines that 2nd URL is appropriate in place of the other
  • now user switches to other language and clicks on banner with home page URL, he get redirected to homepage with code 302,

now in this last case, we tell browser to cache it then we break the language switching again, that what we recently fixed

avatar mbabker
mbabker - comment - 19 Jul 2016

Something still doesn't feel right but you're all the ones dealing with this behavior so I leave it to your capable hands.

avatar ggppdk
ggppdk - comment - 19 Jul 2016

@mbabker

Something still doesn't feel right ...

you are right that it would be nicer to allow caching of some redirects e.g. cache 301 for default language,
but we also need to support the language switching with all possible configurations ...

i just say that this PR does not deal with the topic that you discuss, other PR have dealt with the above,

  • this PR only wants to remove the 301 code for redirects that are obviously not 301, and make them 302, and make no other changes

and this last purpose is succeeded in my tests that is why i marked a successful test

avatar andrepereiradasilva
andrepereiradasilva - comment - 19 Jul 2016

What's the benefit to not caching the second scenario? Something in my gut tells me this isn't the most optimal behavior.

Scenario: you have a site with /en/ (default langauge) and /fr/

If you use a 301 cached redirect.

First time you access / you get a 301 from / to /en/ and this will be cached in the browser.
So now you changed to /fr/ and navigate a little.
Now, while you are in french you access / trought a link (home logo for instance) or direct input. Since the 301 was cached before will go to /en/ (instead of going to /fr/), i.e, it will override the language cookie behaviour.

So we can't cache it.

avatar mbabker
mbabker - comment - 19 Jul 2016

OK that makes sense.

avatar infograf768 infograf768 - test_item - 20 Jul 2016 - Tested successfully
avatar infograf768
infograf768 - comment - 20 Jul 2016

I have tested this item successfully on 38b92ae


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11206.

avatar infograf768 infograf768 - change - 20 Jul 2016
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 20 Jul 2016

RTC. We now get the correct redirections afaik


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11206.

avatar joomla-cms-bot joomla-cms-bot - change - 20 Jul 2016
Labels Added: ?
avatar wilsonge wilsonge - change - 20 Jul 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-07-20 09:35:52
Closed_By wilsonge
avatar wilsonge wilsonge - close - 20 Jul 2016
avatar wilsonge wilsonge - merge - 20 Jul 2016
avatar joomla-cms-bot joomla-cms-bot - close - 20 Jul 2016
avatar joomla-cms-bot joomla-cms-bot - change - 20 Jul 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment