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
preguntada hace 2 años1432 visualizaciones
1 Respuesta
2
Respuesta aceptada

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
respondido hace 2 años
  • 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.

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas