URL rewrite specific page to a subdomain root

0

Hello,

My root website is mywebsite.com, hosted on Webflow. I have another website with subdomain, blog.mywebsite.com, hosted on amplify. And i have a third website, example.mywebsite.com, a nextjs projet running with ELB. My domains are managed with route 53.

My goal is to have mywebsite.com/blog redirects to blog.mywebsite.com and mywebsite.com/example to example.mywebsite.com without the URL to change (so keeping everything under mywebsite.com/) .

Thank you for your help!

1 Answer
0

I think it is possible with behavior settings.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehavior.html

I think "/blog/*" in the behavior's path setting will forward to "blog.mywebsite.com" when accessing "/blog" by setting the origin to "blog.mywebsite.com".
I think it will be fine if the "/example" is set up in the same way.

profile picture
EXPERT
answered a year ago
  • The thing is, I d'ont have any CF distrib for mywebsite.com. How can I create one and still have this domain linked to my Webflow website?

  • The domain configured for Webflow must be configured for the CloudFront distribution. This would require us to change the domain that is currently set up for Webflow. I thought that if it was possible to set up a reverse proxy in Webflow, it would be OK not to set up CloudFront, but after a little research, it seemed difficult to do so.

  • @Riku_Kobayashi I start to understand. I created a CloudFront distribution, with these behaviors: path pattern - origin /blog - blog.example.com default (*) - example.com

    Now I assume I have to delete the route 53 rule pointing example.com to my webflow, and point it toward this cloudfront distribution. But how can I still have example.com CNAME to proxy-ssl.webflow.com ?

    Thanks a lot for your help!

  • The "example.com" should be associated with the CloudFront distribution in the Route53 alias record. Then point the default behavior to proxy-ssl.webflow.com. That is, accessing "https://example.com" will forward to the default origin "proxy-ssl.webflow.com", and accessing "https://example.com/blog" will forward to "blog.example.com". if accessed from.

    path pattern - origin /blog - blog.example.com default (*) - proxy-ssl.webflow.com

  • Ok, so it nearly works: I have a Route53 "example.com" aliasing to my CF distribution, + my behaviors are:

    path pattern - origin /blog - blog.example.com (priority 0) default (*) - blog-example.webflow.io (default domain given by webflow where my site is hosted) (priority 1)

    When I go to example.com, I can see my webflow website (hosted on blog-example.webflow.io). But when I navigate to example.com/blog, I get a 404 Webflow page, as if Webflow is catching the page doesn't exist (which is true on Webflow). Shouldn't Cloudfront match the URL and redirect me to blog.example.com ?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions