A TCP server that proxies requests from a web application for remote HTML. The service proxy runs local to the web application and listens on port 4615.
Overview
When a client connects, the content proxy does the following:
- Validate JSON request from client.
- Load content service's base URL (key: "aps{service}baseurl"), widget's URL pattern (key: "aps{service}{widget}urlpatterns"), and HTML (key:"aps{service}{widget}{request_path}") from memcached. This is a get_multi request where we attempt to retrieve multiple keys from memcached with a single query.
- If content service's base URL and/or widget's URL pattern do not exist in memcached, the Content Proxy will fallback to the database for this information, and then sets it in memcached.
- If "aps{service}{widget}{request_path}" exists, return HTML to client and we're done.
- If "aps{service}{widget}{request_path}" does not exist and {request_path} matches one of the widget's URL patterns, make HTTP request to content service: http ://{baseurl}{request_path}.
- Set HTML in memcached.
- Return HTML to client.
Flow
http://docs.google.com/Present?docid=df5rq9bb_17gtxt5hhr&skipauth=true