Skip to content

Instantly share code, notes, and snippets.

@dj-shin
Created June 17, 2024 08:38
Show Gist options
  • Save dj-shin/5a4e69d8b6c09a303319d7d0082d98ec to your computer and use it in GitHub Desktop.
Save dj-shin/5a4e69d8b6c09a303319d7d0082d98ec to your computer and use it in GitHub Desktop.
Traefik 3.0
curl -vvv --http2 http://localhost:12345/.sse
# Running this will receive streaming response indefinitely, and you can abort it with Ctrl+C
# Access log in traefik container
2024-06-17T08:38:06Z DBG github.com/traefik/traefik/v3/pkg/server/service/loadbalancer/wrr/wrr.go:196 > Service selected by WRR: 0f5208b099bbb948
2024-06-17T08:38:09.004611137Z {"ClientAddr":"192.168.65.1:58764","ClientHost":"192.168.65.1","ClientPort":"58764","DownstreamContentSize":0,"DownstreamStatus":0,"Duration":2291052252,"OriginContentSize":0,"OriginDuration":0,"OriginStatus":0,"Overhead":2291052252,"RequestAddr":"localhost:12345","RequestContentSize":0,"RequestCount":1,"RequestHost":"localhost","RequestMethod":"GET","RequestPath":"/.sse","RequestPort":"12345","RequestProtocol":"HTTP/1.1","RequestScheme":"http","RetryAttempts":0,"RouterName":"sse@docker","ServiceAddr":"172.23.0.2:8080","ServiceName":"sse-traefik-test@docker","ServiceURL":"http://172.23.0.2:8080","StartLocal":"2024-06-17T08:38:06.713031052Z","StartUTC":"2024-06-17T08:38:06.713031052Z","entryPointName":"sse","level":"info","msg":"","request_Accept":"REDACTED","request_Connection":"REDACTED","request_Http2-Settings":"REDACTED","request_Upgrade":"REDACTED","request_User-Agent":"REDACTED","request_X-Forwarded-Host":"REDACTED","request_X-Forwarded-Port":"REDACTED","request_X-Forwarded-Proto":"REDACTED","request_X-Forwarded-Server":"REDACTED","request_X-Real-Ip":"REDACTED","time":"2024-06-17T08:38:09Z"}
2024-06-17T08:38:09.004700179Z 2024-06-17T08:38:09Z DBG github.com/traefik/traefik/v3/pkg/middlewares/recovery/recovery.go:38 > Request has been aborted [192.168.65.1:58764 - /.sse]: net/http: abort Handler middlewareName=traefik-internal-recovery middlewareType=Recovery
version: '3'
services:
traefik:
image: traefik:v3.0
command: --api.insecure=true --providers.docker
ports:
# The HTTP port
- "12345:80"
# The Web UI (enabled by --api.insecure=true)
- "8080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
- "./static-config.yaml:/etc/traefik/traefik.yaml"
sse:
image: jmalloc/echo-server
ports:
- "80:8080"
labels:
- traefik.http.routers.sse.rule=PathPrefix(`/`)
providers:
docker: {}
entryPoints:
sse:
address: ":80"
api:
insecure: true
dashboard: true
debug: true
accessLog:
format: json
fields:
defaultMode: keep
headers:
defaultMode: redact
names:
X-Request-Id: keep
log:
level: DEBUG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment