Commit Graph

65 Commits

Author SHA1 Message Date
Pedro Nasser
6bb1e0c674 improve transparent mode 2016-07-14 18:16:58 -03:00
Pedro Nasser
b58872925a fixed transparent host and added test case 2016-07-14 15:43:06 -03:00
Pedro Nasser
8d7136fc06 fix transparent host header #916 2016-07-14 15:30:00 -03:00
Matthew Holt
62622eb853 proxy: 'transparent' also sets X-Forwarded-For (closes #924) 2016-07-09 17:33:40 -06:00
Maxime
e5bf8cab24 Test that the host header forwarding on the proxy middleware 2016-06-29 16:52:31 -07:00
Matthew Holt
a1bc94e409
Working on a fix for proxy related to setting Host header (cf. #874)
Also see
https://forum.caddyserver.com/t/caddy-0-9-beta-version-available-updated-beta-2/146/29?u=matt
which has another account of strange proxy behavior; I think this
resolves that.
2016-06-28 18:40:07 -06:00
Matthew Holt
80dd95a495
Change outreq.Host instead of r.Host (possibly related to #874)
Also a few little formatting changes and comments.
2016-06-28 18:19:35 -06:00
Viacheslav Biriukov
345ece3850 add multi proxy supprot based on urls 2016-06-28 16:35:35 -06:00
Matthew Holt
a798e0c951 Refactor how caddy.Context is stored and used
- Server types no longer need to store their own contexts; they are
  stored on the caddy.Instance, which means each context will be
  properly GC'ed when the instance is stopped. Server types should use
  type assertions to convert from caddy.Context to their concrete
  context type when they need to use it.
- Pass the entire context into httpserver.GetConfig instead of only the
  Key field.
- caddy.NewTestController now requires a server type string so it can
  create a controller with the proper concrete context associated with
  that server type.

Tests still need more attention so that we can test the proper creation
of startup functions, etc.
2016-06-20 11:59:23 -06:00
David Dyke
07b7c99965 Add timeout to health_check (#887)
* Add timeout to http get on health_check

* Add new test and up the timeout

* Tests for change to default timeout

* Only call http client once and make options more inline with current caddy directives
2016-06-20 09:49:21 -06:00
Andrew Hamon
a50462974c Refactor and clean up policy code
This commit shouldn't change any behavior. It is simply a cleanup of
the different proxy policies. It also adds some comments explaining the
sampling method used, since on first inspection it might not appear to
be a uniformly random selection.
2016-06-18 15:41:18 -05:00
Andrew Hamon
fee4890e94 Balance round robin evenly when some hosts are down (#880)
* Balance round robin evenly when some hosts are down

Before, when load balancing across multiple hosts, if a host went down
then the next host in line would be sent a double share of requests.
This is because the round robin counter was only incremented once per
request, regardless of the health of the selection. If current
selection was unhealthy then the policy would advance to the next host,
but this would not be reflected in the policy counter. To fix this, the
counter is now incremented for every attempted host.

This commit adds a test case that identifies the issue, and a fix.

* Make robin counter private

* Use a mutex to sync round robin selection
2016-06-14 15:43:06 -06:00
David Dyke
b14baf7e20 Add proxy preset: transparent (#881)
* Add reverse_proxy preset

* Update to 'transparent' preset instead of 'reverse_proxy'
2016-06-14 12:03:30 -06:00
Matthew Holt
d3860f95f5
Make RegisterPlugin() more consistent, having name as first argument 2016-06-06 15:31:03 -06:00
Matthew Holt
416af05a00
Migrating more middleware packages 2016-06-05 21:51:56 -06:00