Problem/Motivation
On Drupal 11, when using ui_styles alongside with redirect module. stylesheet.css enter an infinite 301 redirect.
This is due to Drupal\redirect\EventSubscriber\RouteNormalizerRequestSubscriber.
Steps to reproduce
- Enable redirect, ui_styles, ui_patterns modules and ui_suite_bootstrap theme
- Create a content type with layout builder override
- Create a node and try to add accordion
Proposed resolution
As redirect is widely used, ui_styles could be compatible directly by preventing redirect to process the ui_styles.stylesheet route.
Just by adding _disable_route_normalizer: true to route defaults.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | ui_styles-issue-3503776-after-patch.png | 221.71 KB | goz |
| #5 | ui_styles-issue-3503776-infinite-redirect-loop.png | 158.38 KB | goz |
Issue fork ui_styles-3503776
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mattlc commentedTo be tested
Comment #4
grimreaperHi,
Thanks a lot for the report.
But I can't reproduce, is it because my test environment is on D10?
In the Redirect event subscriber what are the variables values that it triggers a redirect?
Comment #5
goz commentedI confirm the issue with D11, and i'm using :
ui_patterns : 2.0.0-rc2
ui_styles: 8.x-1.15
After applying patch, i can add section to my layout.
Comment #6
goz commentedMy bad, i reproduce in D10.4 and D10.3.
In ui_style.routing.yml file, route is defined with .css extension
In Nginx, the following configuration add ?q= because of .css extension.
So in web/modules/contrib/redirect/src/EventSubscriber/RouteNormalizerRequestSubscriber.php, at the end of onKernelRequestRedirect method, redirect_uri is
/ui_styles/stylesheet.css?q=/ui_styles/stylesheet.css&prefix....
so redirect module redirect to this url.
?q should not be there, but it's caused by nginx configuration and because it's not a real CSS file but generated on the fly by controller.
Renaming controller path to something without .css extension solve the issue
Comment #7
goz commentedComment #8
grimreaperComment #9
grimreaperMR rebased and updated.
@pierre, can you test with Drush webserver please?
Comment #10
grimreaperComment #11
pdureau commentedit works with "drush rs"
i have
http://127.0.0.1:8888/ui_styles/stylesheet?prefix=.ck-content&srblbbwithout the.cssextension:Comment #13
grimreaper