0

I'm redirecting traffic for my various domains to HTTPS. Things seem to work fine on my local, but when I deploy to my production site I get the "www.mysite.cn redirected you too many times." error. I'm on Acquia Cloud, so I have limited access to debug apache stuff on the server.

I suspect that this may have something to do with the Domain Access module b/c we have another site with a couple domains running a multisite install (no domain access) and redirects / ssl work fine.

Details:

  • Drupal (7.56) site running domain access (7.x-3.13) for about 10 domains for various languages (site.com, site.de, site.cn)
  • Running on Acquia Cloud Professional (use of "HTTP:X-Forwarded-Proto" should handle load balancer issues)
  • UCC (SAN) SSL certificate with 20 domains on it
  • the .com domain (default for domain access) switches to https with no problems when deployed, all other domains give me the "too many redirects" error
  • on my test environment test.mysite.com resolves to https despite the "RewriteCond %{HTTP_HOST} !^.test..$ [NC]" condition

Relevant code:

.htaccess

#Send sites to www
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^.*devcloud.acquia-sites\.com$ [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Send PROD sites to https
RewriteCond %{HTTP_HOST} !^.*dev\..*$ [NC]
RewriteCond %{HTTP_HOST} !^.*test\..*$ [NC]
RewriteCond %{HTTP_HOST} !^.*local\..*$ [NC]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

settings.php (standard domain access bootstrap include at the bottom)

// domain access
include DRUPAL_ROOT . '/sites/all/modules/contrib/domain/settings.inc';
1

Just in case anyone stumbles upon this (or perhaps for my future self). The issue ultimately ended up being Cloudflare. If you use Cloudflare for any of your domains don't forget to include it in the stack of things you're looking at when debugging (like I did).

If you use Cloudflare, there is a section under the "Crypto" menu for "SSL". I believe the default setting is "Flexible", if you leave this setting you can end up in a situation where you're bouncing between your load balancer and Cloudflare. The setting you want is "Full" once it is set to "Full" you shouldn't keep getting bounced around.

This also explains why our .com was not getting the redirect error. Our .com is the only domain not on Cloudflare b/c that DNS is out of my control

  • Thank you! This fixed it for me. I set it to "Full (strict)" and everything resolved. – ergophobe Oct 3 '18 at 2:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.