2

I am trying to deploy my express app on lambda and api gateway. I use Claudia.js to do the job to wrap my express app. Here are my routes:

app.get("/", function(req, res){
    res.render("hello.ejs");
});


app.get("/redirect", function(req, res){
    res.redirect("/");
});

In my hello.ejs, it contains: <a href="/redirect"> redirect </a>

Then I created a root api "/" with the lambda and hello.ejs is successfully rendered through the api. However, when I click the redirect link, {"message":"Forbidden"} show up.

also the url for the api is somehow modified by aws, xxxx.com/"deploy stage"/ this one becomes the root route, and when I click the "redirect" link, the url becomes xxxx.com/redirect, which does not make sense.

I modified the url to xxxx.com/"deploy stage"/redirect, and the {"message":"Missing Authentication Token"} showed up.

Please help!

Pano
  • 2,099
  • 6
  • 16
  • 24

0 Answers0