Your are certainly right. I'm not very familiar with IP ROUTING so I need to dig a bit to see if there is something I can do. Anyway, Thanks for your help
Just answering to myself. The correct setup I used to make it work is the following :
My router : 192.168.0.1
The static IP I want to use for my UniFi container : 192.168.0.100
I use link aggregation on my DS1513+ on lan1 and lan2. The aggregated link is named bond0. If you are not using this configuration you can probably replace bond0 by eth0.
Please ensure that 192.168.0.100 and 192.168.0.101 are not already in use in your network topology and that your DHCP server won't serve those adresses.
Code:
sudo docker network create -d macvlan --gateway=192.168.0.1 --subnet=192.168.0.0/24 --ip-range=192.168.0.100/32 -o parent=bond0 --aux-address 'host=192.168.0.101' UniFi-Network
Please not this part is not persistent and needs to be done after each reboot (I need to write a script and add is to DSM scheduler)
sudo ip link add UniFi-Bridge link bond0 type macvlan mode bridge
sudo ip addr add 192.168.0.101/32 dev UniFi-Bridge
sudo ip link set UniFi-Bridge up
sudo ip route add 192.168.0.100/32 dev UniFi-Bridge
Now your container has a static IP, and a route so you can reach it from the synology host and from your lan.
Then, you can setup the proxy :
Source:
Description : UniFi
Protocol : https
hostname : unifi.domain.com
port : 443
Destination:
Protocol : https
hostname : 192.168.0.100
port : 443
Custom headers :
X-Real-IP $remote_addr
X-Forwarded-Host $host
X-Forwarded-For $proxy_add_x_forwarded_for
X-Forwarded-Proto $scheme
Upgrade $http_upgrade
Connection "Upgrade"
Now you can access the container by :
https://unifi.mydomain.com/
No need to NAT any port number.