1

I have deployed angular project to lambda with serverless, it is all working fine with aws domain https://xxxxxxx.execute-api.us-west-2.amazonaws.com/production/

but when I bind the custom domain to it, such as https://web.asx200.com.au with mapping to /, it shows me "message": "Forbidden"

if i map to /production with my custom domain, it shows "Uncaught SyntaxError: Unexpected token < " for all the bundled js files.

if i open the network tab to see the http status when trying to open those js, css files, it says 304.

I am running out of ideas. please anyone can help?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
superwalnut
  • 319
  • 5
  • 11
  • You need route53 to point your domain name `https://web.asx200.com.au` to API gateway – Akber Iqbal Jun 25 '19 at 11:30
  • Have you used cloudfront to deliver your angular contents? if so need to point your cloudfront to route53 with your domain. – SamPiy93 Jun 25 '19 at 12:39
  • i think if i try to bind the custom domain, api gateway will generate a cloudfront domain and I have binded that domain to my dns server. (I am managing my dns outside of aws), in this case do I still need route53? – superwalnut Jun 26 '19 at 00:02

1 Answers1

2

You can try

npm run build:prod:deploy

instead of npm run build:serverless:deploy, this works for me.

The script npm run build:serverless:deploy sets the base-href to '/production/' (take a look at the build:browser:serverless script in package.json). This seems like an inconsistency in Serverless Angular Universal and can lead to multiple problems with API Gateway stages or custom domains.

Angular Serverless deployment to AWS appends base-href to url, causing redirect to 404error - angular

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Arthur
  • 110
  • 3
  • 13