Closed (fixed)
Project:
Redirect
Version:
8.x-1.0-alpha5
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
18 Apr 2017 at 04:41 UTC
Updated:
17 Jul 2017 at 22:19 UTC
Jump to comment: Most recent
Comments
Comment #2
berdirPlease read the last few comments in #2852680: Redirect loop when serving cached pages to anonymous users, most like a misconfiguration on your side, happy to add a workaround but I can't reproduce so can't really fix. Probably at some point we want to force-remove the ?q query parameter.
Comment #3
ressaThe Redirect 8.x-1.0-alpha-5 module works as expected for me with simple_sitemap 8.x-2.7+5-dev, without redirect loop.
Comment #4
joos commentedHad a similar problem today after upgrade to 8.3. The site kept looping to q=/?q=/?q=/...
The problem for me was the setting "Enforce clean and canonical URLs." which I disabled to get it to work. Could very well be a config error in my nginx.conf but Ive not been able to find a solution there. A functional example config for nginx would be nice?
Comment #5
replicaobscuraIt's a config error in nginx.conf I think (or possibly other server software if you aren't using nginx), check out my last comments in the issue Berdir linked to regarding what the actual issue is, however that alone might not fix it for sitemap.xml.
Pantheon's current nginx config seems to be broken. It does what I did in the comments there to fix it for normal URLs, but Pantheon still sends certain other URLs, such as sitemap.xml, through @cleanurl which uses the ?q= query string parameter. I've opened a ticket with them to ask about it.
Not sure if you're on Pantheon, but likely you've got the same nginx config issue they currently do.
Comment #6
joos commentedYes, config update fixed our issue. Nginx has a page for Drupal now.
https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/
Comment #7
evanjenkins commentedbmcclure did Pantheon ever get back to you on this issue?
Comment #8
replicaobscuraTicket is still open, I provided detailed information and reproduction steps and they said they're looking into it currently.
Comment #9
replicaobscuraIf anyone's running into this and needs a stopgap solution until it can be resolved in their hosting environment, I put this quick module together:
https://github.com/bmcclure/drupal-sitemap_nginx_config_fix
It simply disables the canonical link redirect behavior on the sitemap.xml path. For me it resolves the issue on Pantheon, until they get the config updated.
If you don't want to enable a whole new module, they key is just to detect the sitemap path and call:
\Drupal::request()->attributes->set('_disable_route_normalizer', TRUE);Comment #10
evanjenkins commentedAwesome thanks! If you wouldn't mind updating when/if they give you an answer I'd appreciate it. Hitting my head on this.
Comment #11
johnhanley commentedAny update on the Pantheon ticket? What's the recommended configuration to resolve this?
I recently ran into this issue after an upgrade to 8.x-1.0-alpha5. I have a Pantheon hosted D8 application that's failing to serve sitemap.xml due to "redirected you too many times."
The aforementioned workaround module fixes the problem (thanks bmcclure), but a permanent solution is optimum.
Please advise.
Comment #12
replicaobscuraNo new update from Pantheon yet--I sent them a request for current status today to see if they're working on it.
In the meantime, this small module can fix the issue: https://github.com/bmcclure/drupal-sitemap_nginx_config_fix
Comment #13
karens commentedI ran into this as well. Not only does this happen at sitemap.xml, it also happens at rss.xml. And probably other non-standard urls.
The module referred to fixed sitemap.xml but rss.xml is still broken. The module could be updated to fix that as well, but there is no telling what other urls might be impacted that haven't been discovered yet.
Instead I looked at the other Redirect settings to see if any of them could fix this. I finally found that unchecking "Enforce clean and canonical URLs." takes care of all the problems I ran into.
I think the code that implements that must be a little too aggressive, at any rate that fixes my problems and all my redirects still work as they should with it unchecked.
Comment #14
replicaobscura@KarenS: You're right about that setting being the problem--the module I created disables that setting for certain paths only, to allow for all other paths to still require canonical URLs. Other than that, the fix is the same as simply disabling that option.
Still no updates from Pantheon on a fix for this btw.
Comment #15
johnhanley commentedJust a word of warning. The temporary fix module in this thread breaks geolocation. As a result we had to disable it and wait for a proper solution from Pantheon.
Comment #16
replicaobscura@johnhanley: Do you know what about it breaks geolocation? Its only function is to call one method in redirect's settings that disables the canonical URL redirect on the /sitemap.xml URL, so it doesn't seem like it should have any interaction with geolocation at all.
Comment #17
roam2345 commentedthe same happens for rss.xml its also gets stuck in this loop.
Comment #18
replicaobscuraGreat news! Latest reply from Pantheon:
I haven't tried it without the fix yet, but here's hoping it's all working properly now!
Comment #19
johnhanley commented@bmcclure: sorry for the delayed response. I now can't remember the particulars, but enabling the module cause some weird anomalies so we quickly disabled it. It's probable our issue was completely unrelated.
Comment #20
roam2345 commentedCan happily report this has been solved as well for us with pantheon.
Comment #21
berdirGreat, then lets close this :)
Changing to a resolved support request seems to make the most sense.