Can you invoke API gateway with just a hostname and without a trailing slash?

1

I have a requirement to provide a URL which will either invoke a Lambda function or could be proxied off to EC2, but the URL cannot contain a trailing slash or any path. For example; https://1234.customers.mysite.com. I can't use https://1234.customers.mysite.com/foo or even https://1234.customers.mysite.com/.

I need to be able to POST to this URL.

In testing via PostMan;

  1. If I invoke https://1234.customers.mysite.com/foo or ./bar I get a 200 return code.
  2. If I invoke https://1234.customers.mysite.com/ I get a 403 return code, "message": "Missing Authentication Token"
  3. If I invoke https://1234.customers.mysite.com I get the same 403 return code and message.

I don't need to get test #2 working, but I just wanted to show that I get the same error as #3. I'm suspecting that if I can get #2 or #3 to work then they'll both work, but that my requirement is really #3.

I have one resource defined for / as a proxy resource with a path of {proxy+} I have no auth defined. I have no UsagePlan defined. I have a custom domain set up and for it's API Mapping I list my deployed stage and left the path blank. I cannot add a header to my POST.

Any help would be greatly appreciated.

Thanks, DB

DB
asked 2 years ago1407 views
1 Answer
2
Accepted Answer

You need to setup the post method to the initial "/", doing so, when you call https://1234.customers.mysite.com/ or https://1234.customers.mysite.com it will work

Here an image of how you need to set it up https://i.postimg.cc/TYcCSWRd/api3.png

Miki
answered 2 years ago
  • Miki, you're brilliant! Your suggestion worked like a charm. As you probably expected I had /{proxy+} for ANY method but an explicit POST for /. Thanks for taking the time and helping me. I truly appreciate it.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions