CDP:Rewrite Proxy Pattern
Proxy Setup for URL Overwriting
Problem to Be Solved
There is a technique for handling load where static content is located on Internet storage or a content delivery service. However, this technique requires you to change the access destination for the static content to the Internet storage, and requires modifications to the existing system such as overwriting the URLs within the content or setting up filters to a web server.
Explanation of the Cloud Solution/Pattern
You can change the access destinations without modifying the existing system through providing proxy server. Providing a proxy server in front of the server for storing the content changes the access destinations of the static content to the Internet storage or content delivery service.
Construct a proxy server using popular software such as Apache or Nginx, and locate the proxy server in front of the existing system.
- Locate a proxy server able to overwrite the content, such as Nginx, between the Elastic Load Balancing (ELB) and the Amazon Simple Storage Service (S3) (which stores the static content), running the proxy server on an EC2 instance.
- Add to the proxy server rules for overwriting URLs within the content.
- As necessary, apply Auto Scaling to the proxy servers.
- Overwriting the access destinations using a proxy server makes it possible to distribute the load of static content without modifying the existing system.
- You must endure redundancy of the proxy server so as to not create an SPOF (single point of failure).
- The web/AP server is located indirectly in ELB, and thus cannot be attached directly to ELB even if there is an increase or decrease in the number of web/AP servers (EC2 instances) through auto scaling.