简体   繁体   English

如何将自定义响应标头添加到在AWS网关中发布的API

[英]How to add custom response headers to an API published in AWS gateway

Can someone explain how to add custom headers to an api published in AWS gateway. 有人可以解释如何将自定义标头添加到在AWS网关中发布的api中。

I did following steps: 1. Added headers under 404(as i want to add header when unauthorised) in"Gateway Responses". 我做了以下步骤:1.在“网关响应”中的404下添加了标头(因为我想在未经授权时添加标头)。

After that, i accessed the URL and checked. 之后,我访问了URL并进行了检查。 I couldn't see the response headers that i added. 我看不到我添加的响应头。

Can someone help me in this. 有人可以帮我吗 Thanks. 谢谢。

It is possible to add a custom header for 404 Status Code using API Gateway's Gateway Response. 可以使用API​​网关的网关响应为404状态代码添加自定义标头。 The header can be a static value in single quotes or it can be a requestParameter . 标头可以是单引号中的静态值,也可以是requestParameter

Ensure that the API is deployed after modifying the Gateway Response. 修改网关响应后,请确保已部署API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM