In 1.1.0 we have gone through a major refactor of the proxy implementation, and added three notable features to the H2O standalone server.
x-reproxy-url header #197
With help from @lestrrat, H2O now recognizes the
x-reproxy-url header sent by upstream servers, and if found, substitutes the response with the response obtained from the URL specified by the header.
When the feature is activated (by adding the line
reproxy: on to the configuration file), any HTTP URL can be served by using the
There is no support for
x-reproxy-file header. Instead, if the authority of the URL matches one of the
host entries of the configuration file, then the reproxied request will be handled internally by the handlers of H2O.
Load distribution among upstream servers #208
To resolve the address of the upstream server, H2O calls
getaddrinfo each time it needs to connect to the servers. As of version 1.1.0 the call is executed asynchronously (by using dedicated threads for the task), and if multiple entries are returned by the name resolver (e.g. DNS,
/etc/hosts, et. al.) then H2O connects to one of them selected at random.
The change neatly constitute as a basis for load balancing. By adjusting the name resolver, you can at any time add or remove an upstream server, or change the selection weight between the servers by using sophisticated DNS servers like
This is only a first step. We plan to polish up the feature for better load balancing.
Directives for tweaking the response headers #204
Following directives have been introduced for mangling the response headers, modeled after those provided by the Apache HTTP server:
For more information, a full list of changes with references can be found in the version 1.1.0 changelog; list of configuration directives can be found by running h2o --help.