- Issue created by @stefdewa
- ๐ฎ๐นItaly Bladedu Italy
I confirm the issue on Drupal 10.1 and redirect module.
My scenario is simpler: I have css/js aggregation active and a plain drupal installation.all files under /sites/default/files/css or js gets redirected to itself appending the query parameters to the existing path until NGINX replies with 414 Request-URI Too Large
- ๐ช๐ธSpain dioni
I have create a patch because it was blocking my current project.
- ๐ช๐ธSpain dioni
Please, use the patch -2, I forgot to include the preg_quote function.
- Status changed to Needs review
over 1 year ago 8:57am 17 July 2023 - last update
over 1 year ago 39 pass, 22 fail - last update
over 1 year ago 39 pass, 22 fail The last submitted patch, 5: 3373123_redirect-2.patch, failed testing. View results โ
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- last update
over 1 year ago 62 pass, 2 fail The last submitted patch, 8: 3373123_redirect-3.patch, failed testing. View results โ
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- last update
over 1 year ago 62 pass, 2 fail The last submitted patch, 13: 3373123_redirect-4.patch, failed testing. View results โ
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- last update
over 1 year ago 62 pass, 2 fail - ๐ฎ๐นItaly Bladedu Italy
I refined a bit your patch (using injected service, but also using a different method for fetching the base path
getDirectoryPath()
method is defined as abstract method from LocalStream from which all other streams are extended.
basePath
, instead, is defined by concrete classes and their implementation of getDirectoryPath calls basePath.Eventually it's the same, but bit more robust (and usable with s3fs module)
- last update
over 1 year ago 61 pass, 4 fail The last submitted patch, 17: 3373123_redirect-5.patch, failed testing. View results โ
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- Status changed to Needs work
over 1 year ago 11:09am 20 July 2023 - ๐ฎ๐นItaly Bladedu Italy
Fixed tests and add one more test to verify that redirect checker returns false when asset path is provided.
- last update
over 1 year ago 62 pass, 2 fail - last update
over 1 year ago 61 pass, 3 fail - last update
over 1 year ago 63 pass - last update
over 1 year ago 63 pass - Status changed to Needs review
over 1 year ago 11:26am 20 July 2023 - ๐ฎ๐นItaly Bladedu Italy
This last patch should work. Going to switch it back to need review.
Thanks!
- ๐ง๐ชBelgium stefdewa
The issue is fixed in Drupal 10.1.2 . Issue ๐ When AssetControllerBase delivers existing file should add content-type Fixed makes sure the correct Content-Type is specified (Fix in code: https://git.drupalcode.org/project/drupal/-/commit/6c8799d135b23bfadbf43... ). Lowering priority to 'Normal'.
Nonetheless, we can go forward with the change here because that reduces website calls.
- ๐จ๐ฆCanada pub497
hmm this seems to still be an issue for me on drupal 10.1.3...although it might be for a different reason as we are not using multilingual support, this is what a resulting css file path looks like:
https://website.com/sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css?q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&q=sites/default/files/css/css_FtDEylGgrC-BYN_tnMeOgX1HzP_qiLJnAp-CJ_1uH6Y.css&delta=0&language=en&theme=gin&include=eJx9kw2WozAIxy9k6xn2JD5CqGaMiQuks87pl_jVsW9236sVfuA_CIiZqf34XYiXxgGOnWb7ze03u_uQf4YC5tRg1fBcZoj3mXPPJGLw8aATb96WGZISJ4MleWKp7C1QT3A50UVZc8GBnpRUbkqiFrT8P1ogvk45yC2GNEojiyhNVrGYVgTOLQL7A4Ofwl59yjxBDF9HWh-zMxXRxYT6pg-pVXCyGj5AzBuzq1vFqxOpB1w6FDlil_oBNTxpLawRkBE059QhtEPoBxyAVb7xF2x_gufpIQVdnb3D1UzZUzczPQN97rGjL93WlwodE3jkMrnVFVK1V5VOGZaO_C5bz7CWiAS0gefogE8OiDaNy0v6IHME3OoQDTguL5kimqe1P_sA9oc276LzsHlcAOYYYT7HuNMEz9s6FxkyKxY9JXe_2Wtu9_t9olTeYeNtrWyJ6v_tYJSegXOyfLUm-4A2Aj7kfww2RejMqPa9fh3yttsy0DyQLaHtc62g8LllJ7nuPThn0QkS9MT_3_qj-M_Mo6OEQ3ta9yP23hEShJl-rd-CC303h5naw_gLPSSaOg
Works fine on drupal 9, also it seems to work fine with the addition of advagg module
- ๐ง๐ชBelgium andreasderijcke Antwerpen / Gent
I'm having this issue also on 10.1.3 when running on our hosting, but not when running in DDEV.
The patch does fix the issue on the hosting.
So far not been able to identify the reason, gut feeling points toward nginx config. - ๐ง๐ชBelgium andreasderijcke Antwerpen / Gent
@pub497 Turns out or issue was indeed due to outdated nginx config, as explained in #3368769-2: 10.1.x breaks Nginx + PHP-FPM with too many redirects even when nginx config is changed โ
- ๐จ๐ฆCanada pub497
hey @andreasderijcke thanks for that! that was exactly the issue I was having
- First commit to issue fork.
- Merge request !67Issue #3373123: Setting 'Enforce clean and canonical URLs.' breaks CSS aggregation on multilingual Drupal 10.1.x with browser caching enabled โ (Closed) created by Juanjol
- last update
about 1 year ago 62 pass, 2 fail - ๐ช๐ธSpain Juanjol Navarra
I confirm that this Issue is currently still occurring in core version 10.1.5 with Redirect version 8.x-1.9.
I have created an MR to make it easier for maintainers to merge this issue. I have added some of the previous patches to the issue so that the contributors don't lose the cลedits, I hope I did it right. In this RM I have also corrected a problem from patch #20 with CSS/JS added on sites whose basepath is not /.
What I have done is that when checking the requests not only is done on $assetsStreamWrapper->getDirectoryPath() but also takes into account the basePath of the $request.
I had thought that perhaps it would be more efficient to use a str_starts_with instead of preg_match, but I have seen that it would not be controlled if these requests are expressly CSS/JS and I believe that on this occasion it is interesting to do it this way, isn't it?
Finally, it seems to me that this issue is important because CSS and JS aggregation is failing in lot of sites, so I have raised the priority to Major. I hope that this last one does not generate discomfort.
- last update
about 1 year ago 62 pass, 2 fail - last update
about 1 year ago 63 pass - last update
about 1 year ago 62 pass, 1 fail - ๐ช๐ธSpain Juanjol Navarra
I have been rethinking and update a bit the MR so that instead of checking the uri of the request, which contains the base path included and extra parameters, what we check is the path info of the request. This is more similar to what we get from the getDirectoryPath of the asset stream.
- ๐ช๐ธSpain Juanjol Navarra
I have been rethinking and update a bit the MR so that instead of checking the uri of the request, which contains the base path included and extra parameters, what we check is the path info of the request. This is more similar to what we get from the getDirectoryPath of the asset stream.
- last update
about 1 year ago 63 pass - last update
about 1 year ago 63 pass - ๐ช๐ธSpain Juanjol Navarra
Added patch with changes from MR to facilitate the installation of the patch with composer until the issue is fixed.
- ๐จ๐ญSwitzerland mullzk
Hi
I tested #34 on my installation and it worked.Drupal 10.1.5, Redirect 8.x-1.9, multilingual
=> Having redirect AND css/js-aggregation enabled leads to css/js-files no longer being loaded.
=> Using the issue-fork from juanjol fixes this (as does disabling css/js-aggregetion or disabling redirect).Thanks a lot for your work. Hope this gets merged soon.
- ๐ช๐ธSpain Juanjol Navarra
Hi mullzk! Welcome :)
If you have tested the latest patch or the MR changes and they are working for you, please consider changing the issue state from Needs review to 'Reviewed and tested by the community'.
Thanks!
- Status changed to RTBC
about 1 year ago 3:14pm 24 October 2023 - ๐จ๐ญSwitzerland mullzk
Tested on 10.1.5 as described in #35, MR resolves the issue
Tested on Drupal 9.5.11 as well, Redirect works as expected, CSS-& JS-Assets are generated as usual. - last update
about 1 year ago 63 pass - ๐ซ๐ฎFinland jhuhta
I'm not 100% sure if I had the same issue. However, the new 10.1 aggregation and Redirect together causes an extra language prefix redirect on a multilingual site. But there's a simpler way to prevent that from happening: just disable the normalization on a given route. Here's a patch that works for me on that.
- ๐จ๐ญSwitzerland dpacassi Zรผrich, Switzerland
Using #39 on two big Drupal sites, has been working so far :)
- ๐ง๐ชBelgium Mschudders
I can also confirm #39 works on a big Drupal multilingual Drupal 10.1.5 with Apache (no NGINX)
- ๐ช๐ธSpain Juanjol Navarra
After some thought and testing, as far as I can see the solution in #39 ๐ Setting 'Enforce clean and canonical URLs.' breaks CSS aggregation on multilingual Drupal 10.1.x with browser caching enabled RTBC is much cleaner than the one we had previously so far, so with your permission I have removed the MR and leave the latest patch as the proposed solution.
- ๐ซ๐ทFrance flocondetoile Lyon
Aggregated JS/CSS was completly broken after upgrading from 9.5.11 to 10.1.6. Using Apache and PHP-FPM.
Patch #39 solves the issue.
RTBC +1 - ๐ฉ๐ชGermany volkerk
Patch #39 works fine on https://www.drupal.org/project/la_eu โ
So another +1 I can also confirm that patch #39 solves the issue.
In my case I experienced redirects for aggregated CSS an JS files from `/sites/default/files/css/css_{hash}` to `/de/sites/default/files/css/css_{hash}` with a 301 status code after rebuilding the cache on a multilingual site - only on front page, that is redirected from `/` to `/{lang}`.
Because I don't want to wait (and 301s are browser cached), I added the code from #39 to a custom module and use it in production now. Thanks @jhuhta.
- ๐ฉ๐ชGermany thomaswalther Rhein-Main Area
#39 solves the issue with endless redirection.
I am missing this patch (with checking the new two collections "system.js_asset" and "system.css_asset") in the newest release 1.9.
- ๐ฉ๐ชGermany andrerb
I have tried the patch from #39, but it does not solve our problem with the css files not being found. Deactivating the option 'Enforce clean and canonical URLs.' on the other hand solves the problem.
* Server: Apache
* Drupal 10.2.2
* redirect 1.9 (patched)
* multilingual
We are still trying to find the reason for this - ๐ท๐ดRomania bbu23
While this behaviour can be confirmed (a multilingual D10 with Enforce clean URLs enabled), in my case I had multiple servers with the same project code & db, but some servers were not affected, they were working fine.
While temporarily disabling the "Enforce clean URLs" confirmed the potential fix of the patch (I was not applying it yet), the question why other server were not affected by this still remained. After deeper investigation, there were permissions + ownership issues with the files folder (recursively). That fixed the problem and no patch was required anymore. Re-enabled the "Enforce clean URLs" and all was fine.
Also temporary dir was fixed in this (there was another issue there)
- ๐ง๐พBelarus sergeiimalyshev
Patch #39 causes this problem https://www.drupal.org/project/drupal/issues/3377310 ๐ 400 exceptions result from requests for old asset paths which are missing the "theme" query string, possibly from cached pages Fixed
- Status changed to Needs work
7 months ago 12:20pm 30 March 2024 - ๐จ๐ญSwitzerland berdir Switzerland
#39 is the correct fix, please provide this as a merge request.
- ๐จ๐ญSwitzerland berdir Switzerland
Berdir โ changed the visibility of the branch 3373123-setting-enforce-clean to active.
-
Berdir โ
committed c1bcaaf2 on 8.x-1.x
Issue #3373123: Setting 'Enforce clean and canonical URLs.' breaks CSS...
-
Berdir โ
committed c1bcaaf2 on 8.x-1.x
- Status changed to Fixed
7 months ago 10:33pm 4 April 2024 Automatically closed - issue fixed for 2 weeks with no activity.
- ๐บ๐ฆUkraine rolki
- ๐ณ๐ฑNetherlands bonrita
Updating the patch https://www.drupal.org/files/issues/2023-10-20/3373123_redirect_fix_aggr... โ It is no longer commaptible with the current version 1.10