Hello,
I migrated my D8 website from my dev (Linux) production server to a live (Windows) server. The site was in maintenance mode when I migrated it. When I took the site out of maintenance mode on production, the only page I could access was the home page. Attempting to access any other pages resulted in infinite loops. The urls looked like this: mysite.com/recipes?recipes?recipes?recipes...
I finally came across a fix described here: https://github.com/omega8cc/boa/issues/1061#issuecomment-331043217. I went to admin/config/search/redirect/settings and unckecked "Enforce clean and canonical URLs". The looping issue was resolved. Of course, all my redirects now look like this: mysite.com/recipes?recipe-url-old if I went to mysite.com/recipe-url-old and got redirected to /recipes.
What would cause this issue? What needs to be fixed in order for me to be able to re-enable that "Enforce..." setting? Is there something I should be looking for in the Windows server settings?
Here are the Windows server specs:
Windows Server 2016
IIS 10
PHP 7.2
MySql 8
Comments
Comment #2
hawkeye.twolfBumping to "Critical" since this prevents access to all pages except
<front>
.Confirmed that Disabling "Enforce clean and canonical URLs" fixed the issue. You can do that while in maintenance mode as described in the issue summary, or via drush:
Perhaps until we figure out what makes this happen, the module's
install
config could at least not enable that setting by default. What do you think?Comment #3
hawkeye.twolfComment #4
ChristophWeber CreditAttribution: ChristophWeber as a volunteer commentedFor what it's worth, the issue and workaround are confirmed on Ubuntu 18.04, nginx 1.14, PHP 7.2, and module version 8.x-1.5.
Every time I enable the module the site goes into a redirect loop as described.
Comment #5
ChristophWeber CreditAttribution: ChristophWeber as a volunteer commentedComment #6
shaktikComment #7
shaktikComment #8
marthinal CreditAttribution: marthinal at Bluespark commentedI had this problem in my local env with DDEV. I've upgraded to DDEV 1.15 and the issue has been fixed.
Comment #9
MLZRAlso confirm: direct after install the site URL was looped. After the route_normalizer_enabled set to 0 things working normal.
Drupal 9.0.6 PHP 7.4.3 + ubuntu 18 + apache
Comment #10
vcastillo CreditAttribution: vcastillo as a volunteer commentedSame problem came up to me after installing redirect 1.6 on a Drupal 9.0.7 , all admin pages went into a loop, after setting route_normalizer_enabled to 0 it seems to fix the issue aswell.
Comment #11
mennovdheuvel CreditAttribution: mennovdheuvel commentedHad this problem today on Drupal 9.1.9 module version 8.x-1.6. Every single admin page + the user login page had infinite redirects to itself.
Deactivating the "Enforce clean and canonical URLs" through drush fixed it.
I imagine this problem was related to the setup I've got:
- Multilanguage with language selection through the hostname
- Varnish reverse proxy
- SSL
My money would be on the redirect module somehow not checking the X-forwarded-proto header for SSL, but I'm not much of a gambler.
Comment #12
sslam CreditAttribution: sslam commentedI have this problem too.
nginx/1.21.0
Comment #13
SaraT CreditAttribution: SaraT commentedI just enabled 8.x-1.6 on a D8.9.18 site and cannot get to any of the pages on my site, including the front page. The URLs all contain many redirects as described before. Looks like nginx/1.20.1 for me.
Comment #14
cristiroma CreditAttribution: cristiroma commentedWe had the same problem on NGINX and the solution was to replace:
with:
Comment #15
tgoeg CreditAttribution: tgoeg commentedHappens with Apache as well on 9.2.x
And I don't really think the webserver itself is the culprit. It can be used to mitigate the problem as shown above.
But looking at the headers in case of infinite redirects, it's clear this module produces the erroneous redirects itself.
In my case it transforms /user/login into /user/login?q=/user/login (and repetitions of this).
Comment #16
jpoesen CreditAttribution: jpoesen at TrainingCloud commentedConfirming that this is still happening on my server environment (but not inside DDEV environments).
Environment:
- Ubuntu 20.04.5 LTS
- PHP 8.0.25
- web server: nginx 1.18.0
- Drupal 9.4.8
- Redirect 8.x-1.8
Steps to reproduce:
- clean standard Drupal 9 install
- fetch Redirect with composer
- enable Redirect
--> redirect loop.
Thanks.
Comment #17
jpoesen CreditAttribution: jpoesen at TrainingCloud commentedWe were able to fix this using the updated nginx confix posted in comment #14 (thanks, @cristiroma!):
This works for D8/D9:
This worked for D7, but NOT for D8/D9:
If someone can post an equivalent fix for Apache, it would be good to add these to the installation instructions.
Comment #18
tgoeg CreditAttribution: tgoeg commentedAs already stated in #15 this should definitely *not* be encouraged and will lead to different problems.
You lose compatibility with requests that do need the
?q=<string>
syntax, which is there for a cause!The module needs to be fixed to stop the recursive requests.
Comment #19
jstollerTry the patch in #3037259: Endless Redirection loop when "Enforce clean and canonical URLs" is enabled. It worked for me to solve a similar issue.
Comment #20
mike.roman CreditAttribution: mike.roman at Clarity Partners commented#2 fixed the issue for me
Comment #21
steinmb CreditAttribution: steinmb as a volunteer commented