0

I have a web application running in an EC2 instance, served from example.com. Our home page, company info, etc. are currently part of the application, but we would like to move those things to a separately managed service — in particular, a WordPress site hosted by a third party. I'm looking for an AWS-managed solution to reverse-proxy the internal application and the external site on example.com, with requests directed to one or the other based on the URL path.

I would use an ELB Application Load Balancer, but as far as I can tell it can't use an external domain or IP as a target (without setting up a direct connect, which isn't relevant here). It looks like CloudFront would do the trick with separate origins for the internal application and WordPress site, but this doesn't really seem like the right tool for the job.

Is there an easy answer?

3
  • Spoiler alert: it's CloudFront. Why do you say it doesn't seem like the right tool for the job? Feb 24, 2020 at 20:51
  • Because I don't need caching or a CDN. CloudFront is great, but it's a large, complicated tool whose primary selling point is something I don't need. I'd prefer something more lightweight, if it exists — but if not, then CloudFront clearly would do the job.
    – Thom Smith
    Feb 24, 2020 at 21:19
  • You could look to see if CloudFlare can do this. It may require a paid plan, but their service and bandwidth tends to be a lot cheaper than AWS in general.
    – Tim
    Feb 24, 2020 at 22:06

1 Answer 1

2

Someone once said...

CloudFront is not just a CDN. It's also an SSL offloader, Host: header rewriter, path prepender, geolocator, georestrictor, secure content gateway, http to https redirector, error page customizer, root page substituter, web application firewall, origin header injector, dynamic content gzipper, path-based multi-origin http request router, viewer platform identifier, DDoS mitigator, zone apex alias target... so don't get too hung up on 'CDN'...

https://stackoverflow.com/a/35616286/1695906

Actually, that was me, so maybe it doesn't count, but I'd suggest that even though CloudFront is marketed as a CDN, it's actually a near-infinite-scale globally distributed reverse proxy that also has a cache, which you can use -- or not use -- at your discretion. I would suggest that this is exactly the solution for the use case described. As long as the origins are accessible from the Internet, they don't have to be in AWS. CloudFront with EC2-hosted sites also conveys some advantages in global networking performance even when it's not caching, because traffic hits an edge location near the viewer and then travels on the AWS managed network back EC2, rather than from the viewer to EC2 over the public Internet.

Of course, you could add HAProxy or Nginx as reverse proxies behind the Application Load Balancer and then use the balancer's path-based target rules to divert the traffic to the reverse proxy which would then send it out of EC2 and over to the 3rd party Wordpress site, but that seems like a step backwards.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .