Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
15
rated 0 times [  16] [ 1]  / answers: 1 / hits: 5618  / 4 Years ago, wed, january 29, 2020, 12:00:00

I have my serverless web app hosted on AWS amplify. I am getting Access Denied error XML if I try refreshing the page. When I look into the Console, it shows no output. The code works fine on localhost, but will cause 403 error on live.



I have found a question that is very similar, except I did not use CloudFront.



enter



How can I find a potential cause of this problem?



enter



Update



I solved this, and I posted the answer in the answer section. However I now have a part 2 of this question.



How do I make it so that the client can directly call my URL like such:



https://URL.com/listing/LISTING_ID



Right now, if I try to call it directly while passing a LISTING_ID the page errors out. Does this have anything to do with Isomorphic ReactJs?



I have tried using Digital Ocean as my web hosting service instead of AWS. The same error happens.


More From » node.js

 Answers
3

I solved this by moving from AWS to Nginx for hosting.



And added this to etc/nginx/sites_available/default



location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
try_files $uri /index.html;
}


The reason why this is happening is because my app was a single paged app. Refreshing causes the browser to request the server, and the server does not handle requests.


[#4901] Monday, January 27, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nestorjarettg

Total Points: 451
Total Questions: 108
Total Answers: 108

Location: Rwanda
Member since Thu, Feb 10, 2022
2 Years ago
nestorjarettg questions
;