Mautic Redirect Loop

Your software
My Mautic version is: 3.1.2
My PHP version is: 7.4
My Database type and version is: 10.3.25

Your problem
After Cache clear Mautic get’s stuck in a 302 redirect loop.

https://www.redirect-checker.org/ says Mautic redirects 19 times. 20 if you start with an http link to the site

This causes browsers to give up. And report that the site has issues.

These errors are showing in the log:
Hmm oddly my install has no errors in Apache’s log or Mautic’s log for the day. So nothing to report here.

Notice some scuttle bud on the web about Symphony redirect issues. But I’ve not found a concrete solution yet. Anyone come across this? :bug:

Steps I have tried to fix the problem:

  • I’ve tried clearing the cache several ways (deleting files in cache directory or console commands).
  • I repair the issue by time-travel to a time before cache is cleared. But this is not sustainable since I’ll need to clear cache at some point in the near future.
1 Like

A little known fact. Mautic + Proxies = Redirects.

Found this little gem in an obscure bit of Mautic’s documentation.

Still searching where to set this up.

1 Like

Hi,
could you add this line to the beginning of your index.php?
$_SERVER[‘HTTPS’] = ‘on’;

Let me know if this fixes the issue.
Thx
Joey

2 Likes

Thanks @Joeyk , that gets me down to 3 redirects. And the site is at least functional again.

https://example.com
302 Found
https://example.com/s/dashboard
302 Found
http://example.com/s/login
302 Found
https://example.com/s/login
200 OK

Okay, that is something. :slight_smile:

Do you have ‘https’ in your /config/local.php?
Also - do you use cloudflare? Who handles your SSL? Is it haproxy?

Indeed is much better. :grinning:

  • Yes I’ve added https in the local.php config before running into this.
  • I use Haproxy to handle the SSL.

@joeyk is there a solution to this? I am currently experiencing this on 4.4.7, Using AWS Application Load Balancer as my proxy to handle SSL and AWS ECS to host the application, I have https in the config for site url as well. but still having issues as I cannot include the emails produced from Mautic in a iframe on a site using https as chrome and other browsers block the request when it tries to redirect to http

Hi,
Can you be plz more specific - what do you mean by include emails as iframe.

I was able to reproduce the issue in a new instance, when I add /index.php to the url it breaks, I assume its because the apache rewrite is using http instead of https because the request from the proxy to the app is http https://codepen.io/williamcomartin/pen/eYPZBPL

Hi. I was having this same problem. Tried @joeyk’s solution and it worked.

Thanks for that!

I was wondering if there would be a possibility to set that variable not from within PHP but from the webserver configuration.

I think that would make it easier to move to v5 and upwards later on.