Mautic v5.1.0 behind Traefik and HTTPS

Your software
My Mautic version is: 5.1.0
My PHP version is: 8.2
My Database type and version is: MariaDB

Your problem
I installed Mautic again today to use it for a project.

I work with Docker, so Traefik runs as an SSL proxy in front of it.

Mautic itself runs without SSL.

Admin and everything is running, so I adjusted the host in the admin and carried on. But when I wanted to send a form, I noticed that Mautic was running on http, emptied the cache and then noticed that Mautic was no longer running at all.

I changed the host in the config.php to without https and emptied the cache, now it works again.

Now my question: How can I “trick” the config so that I enter http there and everything from the admin works as long as it delivers the host with HTTPS in the “JS forms”?

I have already entered the trusted proxies and also set the variable in the .env, but nothing has worked.

Does anyone have a solution here?

I was now able to use the correct trusted proxy to get Mautic to call https://domain.example under system configuration. That didn’t work before, I had the wrong one.

But even when I call the form via JS, it still wants to call the domain via http.

Okay, problem solved.

After I entered the correct proxy and changed the URL from Mautic to https in the system config, I deleted the cache but you also have to call up the form once and save it again, then the form will also be with https when called.