# Mautic Redirect Loop

**URL:** https://forum.mautic.org/t/mautic-redirect-loop/16990
**Category:** Product Support
**Created:** [November 11, 2020, 9:03pm UTC](https://forum.mautic.org/t/mautic-redirect-loop/16990 "2020-11-11T21:03:29Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![codes9](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/codes9/32/682_2.png) [@codes9](https://forum.mautic.org/u/codes9)
#### Post date: [November 11, 2020, 9:03pm UTC](https://forum.mautic.org/t/mautic-redirect-loop/16990/1 "2020-11-11T21:03:29Z")

</div>

**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/](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? 🐛

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.

---

<div class="post-metadata">

### Author: ![codes9](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/codes9/32/682_2.png) [@codes9](https://forum.mautic.org/u/codes9)
#### Post date: [November 12, 2020, 11:30am UTC](https://forum.mautic.org/t/mautic-redirect-loop/16990/2 "2020-11-12T11:30:57Z")

</div>

A little known fact. Mautic + Proxies = Redirects.

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

> **[How to Configure Symfony to Work behind a Load Balancer or a Reverse Proxy...](https://symfony.com/doc/current/deployment/proxies.html)**
>
> How to Configure Symfony to Work behind a Load Balancer or a Reverse Proxy: When you deploy your application, you may be behind a load balancer (e.g. an AWS Elastic Load Balancing) or a reverse proxy ...

Still searching where to set this up.

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [November 13, 2020, 4:59am UTC](https://forum.mautic.org/t/mautic-redirect-loop/16990/3 "2020-11-13T04:59:11Z")

</div>

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

---

<div class="post-metadata">

### Author: ![codes9](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/codes9/32/682_2.png) [@codes9](https://forum.mautic.org/u/codes9)
#### Post date: [November 13, 2020, 8:18am UTC](https://forum.mautic.org/t/mautic-redirect-loop/16990/4 "2020-11-13T08:18:38Z")

</div>

> [@joeyk](#):
>
> $\_SERVER[‘HTTPS’] = ‘on’;

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

[https://example.com](https://example.com)  
**302 Found**  
[https://example.com/s/dashboard](https://example.com/s/dashboard)  
**302 Found**  
[http://example.com/s/login](http://example.com/s/login)  
**302 Found**  
[https://example.com/s/login](https://example.com/s/login)  
**200 OK**

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [November 13, 2020, 10:05am UTC](https://forum.mautic.org/t/mautic-redirect-loop/16990/5 "2020-11-13T10:05:07Z")

</div>

Okay, that is something. 🙂

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

---

<div class="post-metadata">

### Author: ![codes9](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/codes9/32/682_2.png) [@codes9](https://forum.mautic.org/u/codes9)
#### Post date: [November 16, 2020, 7:31am UTC](https://forum.mautic.org/t/mautic-redirect-loop/16990/6 "2020-11-16T07:31:16Z")

</div>

> [@joeyk](#):
>
> Okay, that is something.

Indeed is much better. 😀

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

---

<div class="post-metadata">

### Author: ![wcomartin](https://avatars.discourse-cdn.com/v4/letter/w/71e660/32.png) [@wcomartin](https://forum.mautic.org/u/wcomartin)
#### Post date: [April 13, 2023, 6:34pm UTC](https://forum.mautic.org/t/mautic-redirect-loop/16990/7 "2023-04-13T18:34:28Z")

</div>

@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

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [April 14, 2023, 6:21am UTC](https://forum.mautic.org/t/mautic-redirect-loop/16990/8 "2023-04-14T06:21:10Z")

</div>

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

---

<div class="post-metadata">

### Author: ![wcomartin](https://avatars.discourse-cdn.com/v4/letter/w/71e660/32.png) [@wcomartin](https://forum.mautic.org/u/wcomartin)
#### Post date: [April 15, 2023, 2:24am UTC](https://forum.mautic.org/t/mautic-redirect-loop/16990/9 "2023-04-15T02:24:21Z")

</div>

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](https://codepen.io/williamcomartin/pen/eYPZBPL)

---

<div class="post-metadata">

### Author: ![mchojrin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mchojrin/32/10159_2.png) [@mchojrin](https://forum.mautic.org/u/mchojrin)
#### Post date: [February 27, 2024, 9:42am UTC](https://forum.mautic.org/t/mautic-redirect-loop/16990/10 "2024-02-27T09:42:55Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![tomfriedhof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/tomfriedhof/32/14195_2.png) [@tomfriedhof](https://forum.mautic.org/u/tomfriedhof)
#### Post date: [October 16, 2025, 3:37pm UTC](https://forum.mautic.org/t/mautic-redirect-loop/16990/11 "2025-10-16T15:37:51Z")

</div>

I just setup mautic behind an nginx ingress that does the SSL termination.

The solution @joeyk provided fixed the issue. Looking at the docs that @codes9 linked to solves the issue of not needing to modify the index.php file.

Adding this to your nginx config, as mentioned in the symfony docs linked above ultimately fixes the issue for me.

```auto

# Lie to Symfony about the protocol and port so that it generates the correct HTTPS URLs
            fastcgi_param SERVER_PORT "443";
            fastcgi_param HTTPS "on";

```
