traefik.enable=true
: Enables Traefik for the service. This label is necessary for Traefik to consider this container as part of its routing configuration.
traefik.docker.network=public_network
: Specifies the Docker network that Traefik should use for connections to this service. It's important for network routing.
traefik.http.routers.codechat_api_v2.rule=Host(
apiv2.domain.dev)
: Defines a rule for the router. In this case, it routes requests to apiv2.domain.dev
to this service.
traefik.http.routers.codechat_api_v2.entrypoints=websecure
: Assigns the router to the websecure
entrypoint, usually indicating HTTPS traffic.
traefik.http.routers.codechat_api_v2.priority=1
: Sets the priority of the router. Routers with higher priority values are evaluated first.
traefik.http.routers.codechat_api_v2.tls.certresolver=letsencryptresolver
: Specifies the certificate resolver to use for TLS. Here, it's using Let's Encrypt.
traefik.http.routers.codechat_api_v2.service=codechat_api_v2
: Links the router to the codechat_api_v2
service.
traefik.http.routers.codechat_api_v2.middlewares=corsHeader@docker
: Associates the corsHeader
middleware with this router.
traefik.http.services.codechat_api_v2.loadbalancer.server.port=8083
: Specifies the port on which the service is running. Traefik will forward traffic to this port.
traefik.http.services.codechat_api_v2.loadbalancer.passhostheader=true
: Instructs the load balancer to pass the host header to the backend service.
traefik.http.middlewares.corsHeader.headers.accessControlAllowMethods=GET,PUT,POST,DELETE,PATCH
: Sets allowed methods for Cross-Origin Resource Sharing (CORS).
traefik.http.middlewares.corsHeader.headers.accessControlAllowHeaders=*
: Allows all headers for CORS.
traefik.http.middlewares.corsHeader.headers.accessControlAllowOriginList=*
: Allows all origins for CORS.