能否只使用主机名而不使用斜线尾部来调用 API 网关?

0

【以下的问题经过翻译处理】 我有一个需求,需要提供一个URL,它要么可以调用一个Lambda函数,要么可以代理转发到EC2,但是这个URL不能包含结尾的斜杠或任何路径。例如:https://1234.customers.mysite.com。我不能使用https://1234.customers.mysite.com/foo或甚至https://1234.customers.mysite.com/

我需要能够向该URL发送POST请求。

在PostMan中测试时:

  1. 如果我调用https://1234.customers.mysite.com/foo或./bar,我会得到200的返回码。
  2. 如果我调用https://1234.customers.mysite.com/,我会得到403的返回码,"message":"Missing Authentication Token"。
  3. 如果我调用https://1234.customers.mysite.com,我会得到相同的403返回码和消息。

我不需要让测试#2起作用,但我只是想显示我得到了与#3相同的错误。我怀疑如果我可以让#2或#3起作用,那么它们都会起作用,但是我的需求实际上是#3。

我已经定义了一个资源,路径为/,作为代理资源,路径为{proxy+}。我没有定义身份验证。我没有定义使用计划。我已经设置了一个自定义域名,并在其API映射中列出了我的已部署阶段,并将路径留空。我无法为我的POST请求添加标头。

profile picture
EXPERTE
gefragt vor 6 Monaten16 Aufrufe
1 Antwort
0

【以下的回答经过翻译处理】 您需要设置初始路径的post方法为“/”,这样,当你调用https://1234.customers.mysite.com/https://1234.customers.mysite.com时,它将工作。

这里有一个设置方法的图片:https://i.postimg.cc/TYcCSWRd/api3.png

profile picture
EXPERTE
beantwortet vor 6 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen