问题
AWS API gateway remaps WWW-Authenticate header as x-amazn-remapped-WWW-Authenticate. Our customers use java jetty client and jetty client is failing since jetty client is looking for WWW-Authenticate header
- How to send WWW-Authenticate from AWS API gateway
- Any fix on the Jetty client?
I tried to use gateway response on
1. AWS API gateway response - to handle 400
2. Integration Response - to handle 400 requests and then set the WWW-authenticate header
#set($inputRoot = $input.path('$'))
$input.json("$")
#if($inputRoot.toString().contains("error"))
#set($context.responseOverride.status = 400)
#set($context.responseOverride.header.WWW-Authenticate = 'value')
回答1:
This page documents this behavior.
This behavior cannot be overwritten. If it could, how would you tell the difference between your server sending a 401 Unauthorized
and a WWW-Authenticate
header (indicating that you passed through API Gateway fine and you must authenticate with the server), or API Gateway sending a 401 Unauthorized
and a WWW-Authenticate
header (indicating that your request never reached the server and that you must authenticate with API Gateway)?
来源:https://stackoverflow.com/questions/58037317/getting-x-amzn-remapped-www-authenticate-instead-of-www-authenticate-and-jetty