Traefik doesn't forward data in request

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.

Share your full Traefik static and dynamic config, and docker-compose.yml.

Maybe remove some of the additional pieces in your configuration and try again.

See simple Traefik example.

This is the docker-compose file:

version: '3.8'
services:
  node1:
    image: node
    container_name: node21
    restart: always
    expose:
      - "8080"
    ports:
      - 8081:8080
    volumes:
      - ./config/config.json:/config.json
    labels:
      - traefik.enable=true
      - traefik.http.routers.node1.entrypoints=websecure,web
      - traefik.http.routers.node1.tls=false
      - traefik.http.routers.node1.rule=Host(`node11.$HOST`)
      - traefik.http.services.node1.loadbalancer.server.port=8080
      - traefik.http.routers.node1.tls.certresolver=letsencrypt
    networks:
      vpcbr:
    depends_on:
      - db-1
  db-1:
    image: postgres:node
    container_name: db-1
    restart: always
    expose:
      - "5432"
    volumes:
      - ./postgres-data/db-1:/var/lib/postgresql
    networks:
      vpcbr:
        ipv4_address: 192.168.0.2
  traefik:
    image: traefik:latest
    container_name: traefik
    restart: always
    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=<email>
      - --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
      # Set up an insecure listener that redirects all traffic to TLS
      - --entrypoints.web.address=:80
      - --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
      #logs
      - --log.filePath=./traefik.log
      - --log.level=DEBUG
      - --accesslog=true
      - --accesslog.filepath=./access.log
    environment:
      - CLOUDFLARE_EMAIL=<email>
      - CLOUDFLARE_DNS_API_TOKEN=$CLOUDFLARE_TOKEN
    ports:
      - 80:80
      - 443:443
      - 8080:8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./certs:/letsencrypt
      - ./access.log:/access.log
      - ./traefik.log:/traefik.log
    networks:
      vpcbr:
        ipv4_address: 192.168.0.254
    labels:
      traefik.enable: 'true'
      traefik.http.routers.traefik.rule: Host(`<traefik.example.com>`)
      traefik.http.routers.traefik.entrypoints: websecure
      traefik.http.routers.traefik.tls.certresolver: letsencrypt
      traefik.http.routers.traefik.service: api@internal
    depends_on:
      - node1
networks:
  vpcbr:
    name: vpcbr
    ipam:
      config:
        - subnet: 192.168.0.0/24
          gateway: 192.168.0.1

Using cli for static config and dynamic config is also on docker compose labels.

Best!

I can't find any issue in your config.

POSTing to simple Traefik example works without a problem, whoami will echo the POSTed data back.

Thanks for the recommendation, will deploy with the simplest Traefik config and post my result.

Best,