889 B
889 B
Proxy example
Via the wsf_proxy library, it is possible to implement a simple reverse proxy service.
This example forwards request based on server name, or location as described below:
- if server name is
foo, forwards tohttp://localhost:8080/foo - if server name is
bar, forwards tohttp://localhost:8080/bar - if path starts with "/search/", forwards to
http://www.google.com/search?q=
For instance:
- http://foo/a/test -> http://localhost:8080/foo/a/test
- http://localhost:9090/search/eiffel -> http://www.google.com/search?q=eiffel
Notes:
- look at
{APPLICATION_EXECUTION}.executefor the implementation. - the
send_proxy_responseimplements a general forwarding, but for more advanced need, this could be customized per forwarding. For instance, a specific forwarding, may need the X-Forwarded headers, or to keep theHostfrom the client, ...