Sending this request:
curl --location 'https://<domain>/<path>' \
--header 'Content-Type: application/json' \
--data '{
"some data"
}'
where domain-router is the configured host on docker-compose Traefik:
node1:
image: image
container_name: container
restart: always
expose:
- "8080"
labels:
- traefik.enable=true
- traefik.http.routers.node1.entrypoints=websecure
- traefik.http.routers.node1.tls=true
- traefik.http.routers.node1.rule=Host(`<domain>`)
- traefik.http.services.node1.loadbalancer.server.port=8080
- traefik.http.routers.node1.tls.certresolver=letsencrypt
networks:
vpcbr:
depends_on:
- db-1
The raw http request on the container looks like:
Raw HTTP Request:
POST /<path> HTTP/1.1
Host: <domain>
User-Agent: curl/7.88.1
Content-Length: 161
Accept: */*
Content-Type: application/json
X-Forwarded-For: <ip-address>
X-Forwarded-Host: <domain>
X-Forwarded-Port: 443
X-Forwarded-Proto: https
X-Forwarded-Server: 2753f6988505
X-Real-Ip: <ip-address>
Accept-Encoding: gzip
If I open the container directly to the host and send the request to :, the raw http request is:
Raw HTTP Request:
POST /<path> HTTP/1.1
Host: <host-ip-address>:<exposed-container-port>
User-Agent: curl/7.88.1
Accept: */*
Content-Type: application/json
Content-Length: 161
{
"some-data"
}
This is my Traefik configuration on docker-compose file:
command:
# Tell Traefik to discover containers using the Docker API
- --providers.docker=true
- --providers.docker.exposedbydefault=false
# Enable the Trafik dashboard
- --api.dashboard=true
# Set up LetsEncrypt
- --certificatesresolvers.letsencrypt.acme.dnschallenge=true
- --certificatesresolvers.letsencrypt.acme.dnschallenge.provider=cloudflare
- --certificatesresolvers.letsencrypt.acme.email=
- --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
# Set up an insecure listener that redirects all traffic to TLS
- --entrypoints.web.address=:80
#- --entrypoints.web.http.redirections.entrypoint.to=websecure
#- --entrypoints.web.http.redirections.entrypoint.scheme=https
- --entrypoints.websecure.address=:443
# Set up the TLS configuration for our websecure listener
- --entrypoints.websecure.http.tls=true
- --entrypoints.websecure.http.tls.certResolver=letsencrypt
- --entrypoints.websecure.http.tls.domains[0].main=$HOST
- --entrypoints.websecure.http.tls.domains[0].sans=*.$HOST
# Datadgo metrics
- --metrics.datadog=fals
- --metrics.datadog.address=<datadog-ip>
- --metrics.datadog.addEntryPointsLabels=true
- --metrics.datadog.addrouterslabels=true
- --metrics.datadog.addServicesLabels=true
- --metrics.datadog.pushInterval=10s
- --metrics.datadog.prefix=traefik
#logs
- --log.filePath=./traefik.log
- --log.format=json
- --log.level=DEBUG
- --accesslog=true
- --accesslog.filepath=./access.log
#Configuration
- --tracing=false
- --tracing.serviceName=traefik
- --tracing.spanNameLimit=150
#Datadog tracing
- --tracing.datadog=false
- --tracing.datadog.localAgentHostPort=
- --tracing.datadog.debug=true
- --tracing.datadog.prioritySampling=true
It seems Traefik is not forwarding the data field in the request to the containers.
Appreciate the help.