0

I have been following this tutorial on how to configure my contact form using AWS Lambda/SES/API Gateway

https://www.freecodecamp.org/news/how-to-receive-emails-via-your-sites-contact-us-form-with-aws-ses-lambda-api-gateway/

I am successfully able to test with the deployed Lambda code but he doesn't explain the Nginx/Webserver configuration part. Not sure if this is the correct way but I have tried to have the Contact form POST to the AWS lambda function but Nginx keeps appending my root directory namely /usr/share/nginx/html

Here is the Nginx log:

[error] 29#29: *10 open() "/usr/share/nginx/html/contact/<https:/xxxxxxxxx.execute-api.us-east-1.amazonaws.com/default/SendContactEmail>" failed (2: No such file or directory), client: <ip address>, server: www.website.net, request: "POST /contact/%3Chttps://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/default/SendContactEmail%3E HTTP/2.0", host: "www.website.net", referrer: "https://www.website.net/contact/"

"POST /contact/%3Chttps://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/default/SendContactEmail%3E HTTP/2.0" 404 548 "https://www.website.net/contact/" 

I realize the issue is with location tag in Nginx config but I'm trying to figure out what I'm doing wrong here.

location /contact/ {
    proxy_set_header Host $proxy_host;
    proxy_ssl_server_name on;
}

When I hit the Submit button it should try to contact the AWS Lambda function but instead it gives a 404 not found message because Nginx has the wrong path.

Ray Y
  • 1,261
  • 3
  • 16
  • 24

1 Answers1

0

I found the issue, The javascript code for endpoint did not need the brackets <> . Once I removed that, it all started working as it should.

Ray Y
  • 1,261
  • 3
  • 16
  • 24