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
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')
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)?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With