Passer au contenu

How do I fix this 403 when redirecting www traffic to non-www?

0

I have an S3 website with route-53 and cloudfront. I'm really happy with it.

I've edited the default cloudfront behaviour to redirect http to https and has a function on Viewer Request that rewrites - this looks fine when testing it in the web UI.

however, whenever I go to www. in a browser I get a 403 (either http or https)

It's doing my head in!

1 réponse
2
Réponse acceptée

Hello.

Are you configuring domains with and without "www" in the settings in the CloudFront document below?
I think that if this was not set, an error would occur when accessing with a domain without "www".
Try verifying that the alternate domain is configured successfully.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CreatingCNAME.html
https://repost.aws/knowledge-center/cloudfront-troubleshoot-403-errors

EXPERT
répondu il y a un an
EXPERT
vérifié il y a un an
EXPERT
vérifié il y a un an
  • Oh my goodness Riku that was it! You are officially better than the AI that was helping me :) although it did give some other good advice...

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.