- Issue created by @mattlc
- Merge request !76Prevent redirect to handle ui_styles.stylesheet route → (Merged) created by mattlc
- 🇫🇷France Grimreaper France 🇫🇷
Hi,
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?
- 🇫🇷France goz
I confirm the issue with D11, and i'm using :
ui_patterns : 2.0.0-rc2
ui_styles: 8.x-1.15After applying patch, i can add section to my layout.
- 🇫🇷France goz
My bad, i reproduce in D10.4 and D10.3.
In ui_style.routing.yml file, route is defined with .css extension
ui_styles.stylesheet: path: '/ui_styles/stylesheet.css' defaults: _controller: 'Drupal\ui_styles\Controller\StylesheetController::generateStylesheet' _title: 'UI Styles CSS generator' requirements: _permission: 'access content'
In Nginx, the following configuration add ?q= because of .css extension.
location @rewrite { rewrite ^/(.*)$ /index.php?q=$1; } location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|eot|ttf|woff|woff2)$ { try_files $uri @rewrite; }
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
- 🇫🇷France Grimreaper France 🇫🇷
MR rebased and updated.
@pierre, can you test with Drush webserver please?
- 🇫🇷France pdureau Paris
it works with "drush rs"
~/Projects/Drupal/ui_patterns_2/ $ vendor/bin/drush st Drupal version : 11.1.2 Site URI : http://default DB driver : sqlite DB port : DB username : DB name : db.sqlite Database : Connected Drupal bootstrap : Successful Default theme : ui_suite_bootstrap Admin theme : claro PHP binary : /usr/bin/php PHP config : /etc/php.ini PHP OS : Linux PHP version : 8.3.16 Drush script : /home/pierre/Projects/Drupal/ui_patterns_2/vendor/bin/drush.php Drush version : 13.3.3.0 Drush temp : /tmp Drush configs : /home/pierre/Projects/Drupal/ui_patterns_2/vendor/drush/drush/drush.yml Install profile : standard Drupal root : /home/pierre/Projects/Drupal/ui_patterns_2/web Site path : sites/default Files, Public : sites/default/files Files, Temp : /tmp
i have
http://127.0.0.1:8888/ui_styles/stylesheet?prefix=.ck-content&srblbb
without the.css
extension:HTTP/1.1 200 OK Host: 127.0.0.1:8888 Connection: close X-Powered-By: PHP/8.3.16 Content-Type: text/css; charset=UTF-8 Cache-Control: must-revalidate, no-cache, private Date: Fri, 07 Feb 2025 15:50:12 GMT X-Drupal-Dynamic-Cache: MISS Content-language: en X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Drupal-Cache-Tags: http_response X-Drupal-Cache-Contexts: url.query_args:prefix user.permissions X-Drupal-Cache-Max-Age: 31536000 Expires: Sun, 19 Nov 1978 05:00:00 GMT X-Generator: Drupal 11 (https://www.drupal.org) Content-Length: 45259 X-Drupal-Cache: MISS
-
grimreaper →
committed 0343b00c on 8.x-1.x authored by
mattlc →
Issue #3503776 by mattlc, grimreaper, goz, pdureau: Avoid redirect...
-
grimreaper →
committed 0343b00c on 8.x-1.x authored by
mattlc →
Automatically closed - issue fixed for 2 weeks with no activity.