Everything works except google tts service which is using wrong IP for HA

I had a full working HA installation. Everything was working as it should.
After transferring it behind duckdns with subdomain via swag and with authelia, still everything is working except one thing: google tts service.

In the logs I found an interesting error:
> 2022-08-12 21:41:02 ERROR (Thread-7) [homeassistant.components.cast.media_player] Failed to cast media http://172.17.0.4:8123/api/tts_proxy/a54d88e06612d820bc3be72877c74f257b561b19_en_-_google_translate.mp3 from internal_url (http://172.17.0.4:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

It’s interesting because it’s containing the home assistant docker IP and not the LAN IP of the docker server. And the error is correct, this address is not reachable from the LAN. And replacing the docker IP with the LAN IP of HA the mp3 file is present and playing as it should in a browser.

Is there a way I could tell HA to use the server LAN IP instead of the docker IP?

Also, this is caused by changing the config of the docker container from

network_mode: host

to bridge mode, because this is needed for the swag configuration.
So maybe this could be done via docker somehow, but I didn’t find anything regarding this.