reverse-proxy-traefik-nginx-etc
description: >- The OPC Router in Docker can be run behind a reverse proxy such as Traefik or nginx
Reverse Proxy (Traefik, nginx, etc.)
See also:
HTTP(S) Failover Concepts for REST, OPC UA Server, and WebManagement in the OPC Router
To run the OPC Router in Docker behind a reverse proxy such as Traefik or nginx, you need to configure a few settings. Note that the OPC Router uses both HTTP and WebSocket connections, which must be properly forwarded by the reverse proxy.
This section describes only the steps necessary for Web Management. Additional adjustments may be required for the REST server or other plug-ins.
To optimize network performance, we recommend enabling SSL offloading on the reverse proxy rather than on the OPC Router when using a reverse proxy. This is especially true if the network traffic between the reverse proxy and the OPC Router can be considered secure.
Path Prefix
To access the OPC Router via a reverse proxy with a path prefix, two environment variables must be set. The environment variable WEB_BASE_PATH specifies the path prefix used by the reverse proxy. The environment variable ASPNETCORE_FORWARDEDHEADERS_ENABLED must be set to true so that the OPC Router can process the header information forwarded by the reverse proxy.
Example Traefik configuration:
docker run ... \
-e "WEB_BASE_PATH=/opc-router" \
-e ASPNETCORE_FORWARDEDHEADERS_ENABLED=true \
--label "traefik.http.routers.reverse-proxy.rule=PathPrefix(`/opc-router`)"
Hostname
To make the OPC Router accessible under a specific hostname, you can set up a reverse proxy. When doing so, you must ensure that the reverse proxy host itself is reachable at the specified DNS address. In addition, the environment variable ASPNETCORE_FORWARDEDHEADERS_ENABLED must be set to true so that the OPC Router can correctly process the reverse proxy’s header information.