Files

41 lines
1.2 KiB
Plaintext

$ curl -i localhost:8080/api/hello
HTTP/1.1 200
X-Gateway-Thread: virtual
Content-Type: application/json
{"service":"upstream","message":"hello from the backend"}
$ curl -i localhost:8080/yaml/hello
HTTP/1.1 200
Content-Type: application/json
{"service":"upstream","message":"hello from the backend"}
$ curl -i localhost:8080/diag/thread
HTTP/1.1 200
Content-Type: application/json
{"virtual":true,"thread":"VirtualThread[#58,tomcat-handler-5]/runnable@ForkJoinPool-1-worker-1"}
# what the backend receives by default; note a client-supplied X-Forwarded-For is stripped
$ curl -s -H 'X-Forwarded-For: 1.2.3.4' localhost:8080/api/headers
accept: */*
accept-encoding: gzip,deflate
connection: Upgrade, HTTP2-Settings
host: localhost:9091
http2-settings: AAEAAEAAAAIAAAAAAAMAAAAAAAQBAAAAAAUAAEAAAAYABgAA
upgrade: h2c
user-agent: curl/8.5.0
x-gateway-route: headers
# same request with spring.cloud.gateway.server.webmvc.trusted-proxies=.*
$ curl -s -H 'X-Forwarded-For: 1.2.3.4' localhost:8080/api/headers
forwarded: proto=http;host="localhost:8080";for="127.0.0.1:41308"
x-forwarded-for: 1.2.3.4,127.0.0.1
x-forwarded-host: localhost:8080
x-forwarded-port: 8080
x-forwarded-prefix: /api
x-forwarded-proto: http
x-gateway-route: headers