An AWS Lambda answer cannot be received by AWS Apigateway

Unfortunately, API gateway is unable to see the headers of the redirection response I’m attempting to transmit from an AWS lambda resource. Here is my lambda function’s return line in Java.

return APIGatewayV2HTTPResponse httpResponse = APIGatewayV2HTTPResponse.builder()                                                   .withHeaders(                                                       Map.of("Location", backEnd, "Code", idToken,                                                           "Content-Type", "application/json"))                                                   .withStatusCode(302)                                                   .build();

Screenshot 2023-04-03 122405 Screenshot 2023-04-03 122717 Is there anything wrong?

I tried to add a mapping template like this

{   "method": "$context.httpMethod",   "body" : $input.json('$'),   "headers": {     #foreach($param in $input.params().header.keySet())     "$param": "$util.escapeJavaScript($input.params().header.get($param))"     #if($foreach.hasNext),#end     #end   } }

but it did not help.