apisix
apisix copied to clipboard
bug: forward-auth plugin POST request timeout
Current Behavior
The forward auth plugin uses post requests, request_headers configures Content Type request headers, and requests timeout
Expected Behavior
No response
Error Logs
No response
Steps to Reproduce
this is my config:
{
"forward-auth": {
"_meta": {
"disable": false
},
"client_headers": [
"Location"
],
"keepalive": false,
"request_headers": [
"Authorization"
],
"request_method": "POST",
"upstream_headers": [
"xx-gw-id"
],
"uri": "http://127.0.0.1:9080/checkAuth"
}
}
I timed out using the Postman request interface。 When I removed the Content Type from request_headers, it did not time out but reported an error: {"code": 400, "reason": "CODEC", "message": "unregister Content Type:", "metadata": {}}
Environment
- APISIX version (run
apisix version
): - Operating system (run
uname -a
): - OpenResty / Nginx version (run
openresty -V
ornginx -V
): - etcd version, if relevant (run
curl http://127.0.0.1:9090/v1/server_info
): - APISIX Dashboard version, if relevant:
- Plugin runner version, for issues related to plugin runners:
- LuaRocks version, for installation issues (run
luarocks --version
):
"Authorization", "Content-Type", Content-Length "x-offcn-gateway-id",
There is something wrong with this json format. Please make sure the json format is OK
Sorry, the json format has been changed
Can you try example like this ? https://apisix.apache.org/docs/apisix/plugins/forward-auth/#example-usage I have try to do like it , it works fine .
@hanqingwu Yes, I have no problem with that example on my end. Now downgrade the version from 3.8.0 to 3.6.0, there's no problem
thanks @dashixiongsk . I was having the same issue and successfully resolved it by downgrading to 3.6.0
@dashixiongsk to clarify - this timeout error is encountered when setting "request_method": "POST"
?
我这边遇到了同样的问题,验证3.6.0 及 3.7.0 是可以的,但是3.8.0及以上就会出现同样的问题,POST转发到下游,下游无法读取
org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters,line: 195,params: ,err_msg:
org.springframework.http.converter.HttpMessageNotReadableException: I/O error while reading input message
at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:195)
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:163)
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:136)
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:122)