Segment mails Site-URL using {webview_url} and {tracking_pixel}

Your software
Server: Linux xxx 5.10.0-13-amd64 #1 SMP Debian 5.10.106-1 (2022-03-17) x86_64
My Mautic version is: 4.2.1 (upgraded from 4.0.x)
My PHP version is: 7.4.28
My Database type and version is: 10.5.15-MariaDB-0+deb11u1

Your problem
My problem is:
We have setup our Site-URL to “”. This domain however isn’t always properly used. See this example:

  1. I create a new segment mail, using a theme which utilizes {webview_url} and {tracking_pixel}.
  2. I save and close the e-mail.
  3. The “Preview URL” for some mails show the IP address of our domain (https://10.10.x.x/email/preview/x) instead of the Site-URL.
  4. I send an example to myself. The {webview_url} and {tracking_pixel} fields are correctly substituted by the Site-URL.
  5. I send the actual e-mail. The {webview_url} and {tracking_pixel} fields are not correctly substituted by the Site-URL. They instead show a URL to https://10.10.x.x/.
  6. After I send the e-mail, the “Preview URL” in Mautic now shows the actual Site-URL) (

The logs don’t show any issue. I have cleared the cache, both using ‘php bin/console cache:clear’ and ‘rm -rf var/cache/*’.

Also verified that my config/local.php site_url is set up correctly. In the database or the mautic folder I can find no reference to our internal IP address.

I would like to prevent having to do a clean install, is there any way to fix this issue? I recently upgraded to 4.2.1 but also had this issue in older versions. I’ve upgraded from 4.0.2.

I did some more research and found someone else with this issue: Segment Mails do not use site_url (better version) · Issue #10137 · mautic/mautic · GitHub

Apparently Mautic doesn’t use the site_url in the configuration when sending out Segment mails. Instead, it’s uses the URL the admin is using to access Mautic and start the Segment mail (in my case, 10.10.x.x instead of We are using our Mautic instance behind a reverse proxy. I’ll try to change it there so this proxy addresses the Mautic instance by it’s FQDN instead of IP-address.

EDIT: I can confirm this is the issue. My reverse proxy was accessing the Mautic instance on https://10.10.x.x/ instead of This causes Mautic to use that URL (instead of site_url specified in the configuration) for links in Segment mails. It doesn’t happen on sending examples, but when actually sending the e-mails the problem occurs. Now that I’ve changed my reverse proxy (by adding a manual entry for to 10.10.x.x) to access the Mautic instance on the FQDN-URL, the issue is resolved.

Hi @Milenco,
I think I am having the same issue as you. I am also using the Mautic instance behind a reverse proxy. But I don’t really understand your solution. Could you please explain again what exactly did you do in order to fix the problem? What do you mean by “adding a manual entry”? Thanks!

Hello @ilo,

Sorry for the delayed response.

So, in my case, my reverse proxy is a Windows Server machine running IIS. The problem is that IIS is accessing Mautic through instead of This URL is used in the webview_url and tracking_pixel shortcuts.

To prevent this, you need to have IIS access your Mautic instance through (instead of the IP directly). But, because translates to a public IP-address, your IIS instance needs to be tricked to access the DNS-name through it’s local IP-address. To do so, edit C:\Windows\system32\drivers\etc\hosts and add a line for which has Mautics local IP in it.

Hi @Milenco,
Thank you for your answer.
In my case, I’ve finally fixed my issue by adding $_SERVER[‘HTTP_HOST’] = ‘mautic.domain’ in index.php. Otherwise, all my segment emails were sent with links being overwritten by reverse proxy’s url instead of Mautic’s site_url.