When both services are in Docker, you can use configuration discovery, like simple Traefik example.
If you explicitly want to create a Traefik router proxying/forwarding requests to another domain, you need to use a dynamic config file, like simple Traefik forward example.
thank you for reply. From the Internet the traffic hits to my traefik VM using url: nextcloud.example.com and that needs to be forwarded to nextcloud.local.example.com which is managed by traefik but I am getting 404 page not found...
Here is what I did:
If the forwarded request should have the host header of the forwarded domain, not from the original request, then you can try to set passHostHeader: false (doc):
did any one resolve this? I thought it would be easy to forward traffic from 1 traefik instance to another? All I need is to forward traffic coming into traefik instance 1 on https://service.example.com to another traefik instance handling https://service.local.example.com
I want the public facing traefik instance to forward traffic to internal services handling traefik instance. So if the host is test.example.com...it should be forwarded to test.local.example.com managed by a second traefik instance
http:
#region routers
routers:
service_on_different_vm:
entryPoints:
- "https"
rule: "Host(`service.example.com`)"
middlewares:
- default-headers
- https-redirectscheme
tls: {}
service: service_on_different_vm
#endregion
#region services
services:
service_on_different_vm:
loadBalancer:
servers:
- url: "https://service.local.example.com"
passHostHeader: false
The only thing you need to make sure is that your firewall is not blocking traffic between the two instances 😂😂🤭