New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log Request/Response headers/body #1003
Comments
Please note that I have a working function for this:
|
What you have looks fine for headers (though you'll loose multi value headers). For the request/response body I wouldn't recommend doing it 100% of the time since you'll have to buffer all requests/responses into memory. See the |
I custom a plugin project for spring-cloud-gateway. You can take a look at it . Issues and PR welcome. https://github.com/chenggangpro/spring-cloud-gateway-plugin BTW: Read Request And Response cost a lot of memory.Wouldn't recommend doing it 100% of the time. |
@chenggangpro I will take a look at it in the weekend :) thanks |
Hi! I need to get the request body content for routes defined in the application.yml
is filled for all requests (also the one out of the yml) you can find the code here https://gist.github.com/matzegebbe/bf631b2d3ab6d55f58f4b6c1d3511189 curl -H "x-debug: /nginx/" -X POST -d "{'data':'fooBar'}" http://localhost:8080/nginx/ with application.yml - id: nginx
uri: http://localhost:8082
predicates:
- Path=/nginx/**
filters:
- StripPrefix=1 gives me the log
|
Here is a variant that use modify filters to capture and log request and response body
|
Question
Hi guys I want to create a simple filter to log request and responses, their headers and body for all requests(GET/POST/PUT/DELETE) passing through the gateway.
Is it possible to do this?
I cannot find a good solution to read the request/response body
The text was updated successfully, but these errors were encountered: