-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Don't append but set the "Content-Encoding" header value in htaccess.txt #39205
Don't append but set the "Content-Encoding" header value in htaccess.txt #39205
Conversation
In the past changes in the htaccess.txt file have been accompanied by a post-installation message. |
I have tested this item ✅ successfully on 60109ea to The joomla works properly in both standalone installation and in a subdirectory where gzip has already been applied. Without the change, joomla installed in subdirectory causes error due to double encoding of gzip. Thank you Rchard! This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39205. |
Yes, I remember now. Will do that when there is feedback telling that it should be done. |
I think a change is needed here: https://docs.joomla.org/Preconfigured_htaccess This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39205. |
To me that seems to be outdated document which does not describe our standard htaccess.txt as it is now. I am reluctant to do anything with that and will close this PR if I am forced to update that. |
To be honest, I didn't look for which joomla version this .httaccess is for.
I understand. Don't close, because this PR is of great use and importance. |
Hmm, I've just checked again, this time on my desktop with a bigger screen, and it seems I was wrong and that documentation is still in use and should be updated when this PR here gets merged. |
I have tested this item ✅ successfully on 60109ea This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39205. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39205. |
This really should get a post installation message before it can be merged |
@brianteeman I think it should only be shown for updates, right? Or also for new installs? Could you point me to an other postinstall message which I could use as example? |
Just for updates will be fine. There are several examples in the |
I have added a postinstall message for updated sites only and updated the testing instructions. It needs now human tests for the 2nd test for the postinstall message. It also needs to update the example given in the documentation here https://docs.joomla.org/Preconfigured_htaccess . But I think this should be done after this PR has been merged so that documentation does not tell something which is not implemented yet. |
I have to fix a syntax error in the update SQL for PostgreSQL. Stay tuned. |
Done. Works. |
I tested the package and the new post installation message appears as expected. Thanks for adding it to the PR and of course for the fix itself! |
Thanks |
I've just updated the content of the .htaccess file on https://docs.joomla.org/Preconfigured_htaccess with the change from this PR. That docs page shows at the top a hint telling that there are changes which have not been marked for translation. This was already the case before my edit. @toivo Do you have an idea how to fix that? |
@richard67 Nothing in the last 30 days was listed, then I changed 30 to 300 in the address bar and the following sentence was listed: Enter a page name to see changes on pages linked to or from that page. (To see members of a category, enter Category:Name of category). Changes to pages on your Watchlist are in bold. |
joomla/joomla-cms#39907 + joomla/joomla-cms#39705 + joomla/joomla-cms#39924 - (только для en-GB) joomla/joomla-cms#39930 - (только для en-GB) joomla/joomla-cms#39923 - (только для en-GB) joomla/joomla-cms#39205 +
Pull Request for Issue #39176 .
Summary of Changes
The
Header append Content-Encoding gzip
is changed toHeader set Content-Encoding gzip
in the section for the gzipped resource files of thehtaccess.txt
file.This makes sure not to get an invalid value "gzip gzip" value but a correct "gzip" for the "Content-Encoding" header of the gzipped resource files when following conditions are met:
.htaccess
file is used in that subdirectory which is based on the Joomla 4htaccess.txt
file and so has the last section for the gzipped resource files in use.npm run gzip
to create the gzipped resources for testing)..htaccess
file like that in use. That can be the case e.g. if you have the above mentioned Joomla installation in a subdirectory of a Joomla installation.See also the Drupal issue https://www.drupal.org/project/drupal/issues/1116416 linked in #39176 for a detailed description and discussion of the issue.
As concluded there in the discussion, the initial approach to do the same change also for the later
Header append Vary Accept-Encoding
line was abandoned because that header value can be a list of multiple http headers, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary . Therefore I also don't change that in ourhtaccess.txt
.In addition, a postinstall message is added, but only for updated sites, not for new installations, as the latter come already with the correct htaccess.txt file.
Testing Instructions
1. Testing the .htaccess change
Have an Apache webserver with mod_rewrite enabled and mod_gzip and mod_deflate disabled.
Have an
.htaccess
file in your webserver's document root which contains at least the last section of our Joomla 4htaccess.txt
file:This can be because you already have a Joomla 4 installation there and you use URL rewriting.
Create a new subdirectory below that and install a Joomla 4.2.5 or latest 4.2.6-dev nightly build into that directory.
Enable URL rewriting for that installation and copy
htaccess.txt
to.htaccess
.Request some page of that installation with a forced reload and watch the network tab of your browser's developer tools.
Check the "Content-Encoding" in the http response of one of the gzipped css or js resources.
Result: Value "gzip gzip", see section "Actual result BEFORE applying this Pull Request" below.
Change the
.htaccess
file of the installation in the subdirectory in the same way as this PR changes thehtaccess.txt
file.Repeat steps 4 and 5.
Result: Value "gzip", see section "Expected result AFTER applying this Pull Request" below.
2. Testing the postinstall message
Make a new installation with the installation package created by drone for this branch and verify that the new postinstall message is not shown.
Update a 4.2.8 or older or a current 4.2-dev branch to the update package created by drone for this PR and verify that after the update the new postinstall message is shown.
Actual result BEFORE applying this Pull Request
Header "Content-Encoding" has value "gzip gzip" in the http response for a gzipped resource file.
Expected result AFTER applying this Pull Request
Header "Content-Encoding" has value "gzip" in the http response for a gzipped resource file.
Link to documentations
Please select:
Documentation link for docs.joomla.org: https://docs.joomla.org/Preconfigured_htaccess
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
When the PR gets merged, I will care for the update of the documentation mentioned above.