AWS Api网关:缺少身份验证令牌 [英] AWS Api Gateway: Missing Authentication Token
问题描述
所以我有一个链接到lambda函数的api网关的自定义域名设置. 如果我 https://api_domain.com/something 可以正常运行,则行为符合预期.
So i have a Custom Domain Name setup for api gateway linked to a lambda function. I have it working fine if i do https://api_domain.com/something the behavior is as expected.
资源:/{proxy +} 基本路径映射:/
Resource: /{proxy+} Base Path Mappings: /
但是当我进入根域并尝试显示该URL的内容时,我无法正常工作
But when i go to the root domain and try to display something for that url i can't get it to work
{"message":"Missing Authentication Token"}
搜索我发现的地方
如果您遇到缺少身份验证令牌"错误, 没有将资源添加到您的uri.对我来说,浏览至 https://{api_domain}/{stage}导致该错误.如果你这样做 https://{api_domain}/{stage}/{resource_name},则错误可能 消失.
The "Missing Authentication Token" error might be happening if you aren't adding the resource to your uri. For me, browsing to https://{api_domain}/{stage} results in that error. If you do https://{api_domain}/{stage}/{resource_name} then the error may disappear.
是否有一种方法可以显示针对根域的自定义内容,还是显示该丑陋错误的唯一选择?
Is there a way to display something custom for the root domain or is the only option to display that ugly error?
推荐答案
向/
根资源添加方法.当您发现/{proxy+}
与根目录不匹配时,您必须单独处理它.
Add a method to the /
root resource. As you have discovered the /{proxy+}
doesn't match the root, you have to handle it separately.
这篇关于AWS Api网关:缺少身份验证令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!