Issue and potential solution reported by Roger López.
If users hit the site at an address without without a country path prefix, and the site is set to default to the default country (rather than global), one of two things happen:
1. If page caching is not enabled, they get a country-specific page even though the address is not country-specific.
2. If page caching is enabled, they get a page for the country of the user whose page view triggered the cache entry.
Both of these are incorrect. The expected behaviour is: they are forwarded to a country-specific path and get the country-specific page (in an appropriate language).
Addressing this issue is complicated by the fact that we set country in hook_boot, where we don't have access to drupal_goto()
. We may need to explicitly set the location in hook_boot.
Comments
Comment #1
nedjoClarification:
Scenario: User hits site at http://example.com or http://example.com/somepath.
Expected behaviour:
1. If user's country is detected and is supported, user is forwarded to country-specific path, e.g. http://example.com/ca, http://example.com/ca/somepath.
2. If user's country is either not detected or is detected and is not supported:
a. If site is set to use global as a fallback, no forwarding occurs--user stays on the original path and gets the global content.
b. If site is set to use the default country as a fallback, user is forwarded to country-specific path as above for the default country.
Comment #2
nedjoRoger López is working on a patch.
Comment #3
catchAre there any elements of this which aren't covered in #330156: Language not considered in page caching--users get wrong page - and is #1 a result of browser language determination if so?