Commit Graph

1311 Commits

Author SHA1 Message Date
Pedro Nasser
54355d8fb3 replace strings.Split for SplitN 2016-06-16 10:03:31 -03:00
Pedro Nasser
e486c9c6e7 fix rewrite bug with url query + test case 2016-06-15 19:55:02 -03:00
Matt Holt
0f1e5bcebf Merge pull request #876 from hacdias/patch-1
Add minify directive
2016-06-14 15:44:04 -06: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
2b06edccd3
Use challenge domain for tls-sni solver
Matches the new upstream function signature and fixes previously broken
behavior; new solver code confirmed to work during restarts
2016-06-13 17:48:59 -06:00
Henrique Dias
492d5aa37f Merge branch 'master' into patch-1 2016-06-10 07:34:42 +01:00
Henrique Dias
1e4a4109a7 Update plugin.go 2016-06-10 07:31:07 +01:00
Matthew Holt
daa4de572e
Ensure certificate has a non-nil config when caching (fixes #875)
Also we change the scheme of the site's address if TLS is enabled and
no other scheme is explicitly set; this makes it appear as "https" when
we print it; otherwise it would show "http" when TLS is turned on
implicitly, and that is confusing/incorrect.
2016-06-09 19:12:11 -06:00
Henrique Dias
83451ea2a0 Update plugin.go 2016-06-09 16:06:50 +01:00
Henrique Dias
06fed0db17 Add minify directive 2016-06-09 15:14:46 +01:00
Matt Holt
98cf26377c Merge pull request #873 from mholt/fix-restart
Fix restart on USR1 not loading new Caddyfile
2016-06-08 17:40:16 -06:00
Benny Ng
ff82057131 Fix restart on USR1 not loading new Caddyfile 2016-06-09 07:12:01 +08:00
Matthew Holt
6492592b4a Update change list, fix build script; version 0.9 beta 1 2016-06-07 14:33:06 -06:00
Gustavo Chaín
6c847d0723 New {request} placeholder to log entire requests (sans body) (#871)
Add a {request} placeholder to the replacer.

Closes #858.
2016-06-07 11:06:24 -06:00
Matt Holt
01e05afa0c Merge pull request #870 from mholt/close-idle-conn
Close idle connections after graceful shutdown timeout
2016-06-07 09:38:58 -06:00
Matthew Holt
e7fc26e3fb
Improved godoc, added two missing directives, update change log 2016-06-07 09:27:14 -06:00
Benny Ng
37ae21001d Close idle connections after graceful shutdown timeout 2016-06-07 18:32:27 +08:00
Benny Ng
b23eec4fac Update go get path for Caddy binary (#869) 2016-06-07 12:09:52 +08:00
Matthew Holt
727ef24306
Improve godoc for plugin facilities 2016-06-06 18:27:54 -06:00
Matthew Holt
d3860f95f5
Make RegisterPlugin() more consistent, having name as first argument 2016-06-06 15:31:03 -06:00
Matt Holt
9b4134b287 Merge pull request #866 from mholt/0.9-wip
Merge 0.9 into master (warning: huge diff)
2016-06-06 07:39:16 -06:00
Leo Koppelkamm
ddff08392a Make upstart script more fault tolerant and easier to debug (#824)
* Make Upstart script more fault tolerant and easier to debug

* update readme
2016-06-06 07:32:27 -06:00
Matthew Holt
71c14fa16e
Make sure Root is set for all new SiteConfigs
This situation typically only arises in tests...
2016-06-05 23:34:16 -06:00
Matthew Holt
ff22fbd79a
Migrate existing add-on names; set default root in SiteConfig 2016-06-05 23:24:34 -06:00
Matthew Holt
a762dde145
Migrate remaining middleware packages 2016-06-05 22:39:23 -06:00
Matthew Holt
416af05a00
Migrating more middleware packages 2016-06-05 21:51:56 -06:00
Matthew Holt
2f92443de7
More tests, several fixes and improvements; export caddyfile.Token
We now sneakily chain in the errors directive if gzip is present but
not errors. This change fixes #616.
2016-06-04 22:50:23 -06:00
Matthew Holt
49fdc6a20a
Add errors middleware; export httpserver.WriteTextResponse 2016-06-04 22:48:27 -06:00
Matthew Holt
ac4fa2c3a9
Rewrote Caddy from the ground up; initial commit of 0.9 branch
These changes span work from the last ~4 months in an effort to make
Caddy more extensible, reduce the coupling between its components, and
lay a more robust foundation of code going forward into 1.0. A bunch of
new features have been added, too, with even higher future potential.

The most significant design change is an overall inversion of
dependencies. Instead of the caddy package knowing about the server
and the notion of middleware and config, the caddy package exposes an
interface that other components plug into. This does introduce more
indirection when reading the code, but every piece is very modular and
pluggable. Even the HTTP server is pluggable.

The caddy package has been moved to the top level, and main has been
pushed into a subfolder called caddy. The actual logic of the main
file has been pushed even further into caddy/caddymain/run.go so that
custom builds of Caddy can be 'go get'able.

The HTTPS logic was surgically separated into two parts to divide the
TLS-specific code and the HTTPS-specific code. The caddytls package can
now be used by any type of server that needs TLS, not just HTTP. I also
added the ability to customize nearly every aspect of TLS at the site
level rather than all sites sharing the same TLS configuration. Not all
of this flexibility is exposed in the Caddyfile yet, but it may be in
the future. Caddy can also generate self-signed certificates in memory
for the convenience of a developer working on localhost who wants HTTPS.
And Caddy now supports the DNS challenge, assuming at least one DNS
provider is plugged in.

Dozens, if not hundreds, of other minor changes swept through the code
base as I literally started from an empty main function, copying over
functions or files as needed, then adjusting them to fit in the new
design. Most tests have been restored and adapted to the new API,
but more work is needed there.

A lot of what was "impossible" before is now possible, or can be made
possible with minimal disruption of the code. For example, it's fairly
easy to make plugins hook into another part of the code via callbacks.
Plugins can do more than just be directives; we now have plugins that
customize how the Caddyfile is loaded (useful when you need to get your
configuration from a remote store).

Site addresses no longer need be just a host and port. They can have a
path, allowing you to scope a configuration to a specific path. There is
no inheretance, however; each site configuration is distinct.

Thanks to amazing work by Lucas Clemente, this commit adds experimental
QUIC support. Turn it on using the -quic flag; your browser may have
to be configured to enable it.

Almost everything is here, but you will notice that most of the middle-
ware are missing. After those are transferred over, we'll be ready for
beta tests.

I'm very excited to get this out. Thanks for everyone's help and
patience these last few months. I hope you like it!!
2016-06-04 17:00:29 -06:00
Matt Holt
e1a6b60736 Merge pull request #861 from marc-gr/upstream
Add upstream directive
2016-06-03 17:50:33 -06:00
Marc Guasch
9b5ad487d7
Add several upstreams test case 2016-06-04 01:07:53 +02:00
Marc Guasch
d291b76721
Gofmt fixes 2016-06-03 22:48:24 +02:00
Marc Guasch
881da313dd
Add tests for upstream directive 2016-06-03 21:36:15 +02:00
Marc Guasch
1bdbf9d6ba
Add parseUpstream method 2016-06-03 21:36:15 +02:00
Matt Holt
2536ea74d9 Merge pull request #859 from jupiter/fix/issue-643
Fix for cleaned URL.Path
2016-06-02 16:43:34 -06:00
Pieter Raubenheimer
9acfec5418 Fix cleaned URL path in proxy 2016-06-02 22:08:10 +01:00
Abiola Ibrahim
a0e6eb3ba9 Merge pull request #855 from abiosoft/proxy-host-patch
Fix for #854
2016-05-29 08:11:27 +01:00
Abiola Ibrahim
6e6d9e7e9e Fix for #854 2016-05-29 07:55:40 +01:00
Matthew Holt
238250e7e6
Recommend forum in issue template 2016-05-27 10:16:11 -06:00
Matthew Holt
324ec15890
Link to forum 2016-05-27 09:15:06 -06:00
Matthew Holt
c64361a753
Use latest Go version (1.6.2) for CI builds 2016-05-24 18:37:44 -06:00
Matt Holt
6d9dcb1729 Merge pull request #846 from nesl247/fix-845
Strip [] from IPv6 addresses for FastCGI.
2016-05-24 13:56:55 -06:00
Harrison Heck
da97ac7c63 Strip [] from IPv6 addresses for FastCGI.
Fixes #845.
2016-05-24 15:19:50 -04:00
Matt Holt
374d0a3f09 Merge pull request #840 from mholt/more-systemd
systemd, README: Edit to account for the recent spike in reports
2016-05-21 14:44:58 -06:00
W-Mark Kubacki
bee9c50a71
systemd, README: needs to be version 229 or later, and how to display logs
We have had three operators within a few days which ran into the same cause
and had not been able to figure out what went wrong.

addresses #833, #822
2016-05-21 00:54:44 +02:00
Matthew Holt
bac29cc20a Change image http -> https 2016-05-15 08:26:20 -04:00
Matt Holt
e6b1028da9 Merge pull request #823 from ponychicken/patch-1
fix typo
2016-05-14 17:20:19 -04:00
Leo Koppelkamm
4c62397ff8 fix typo 2016-05-14 16:39:00 +02:00
W. Mark Kubacki
e516aebc08 Merge pull request #817 from mholt/systemd-service-file
Provides some more guidelines to operators on how to avoid running Caddy as root.

Introduces an user www-data, which really is a placeholder. Such an user with the same UID/GID combination is created on the most popular Linux distribution. I trust any operator can spot the difference to his/her distro and adjust the unit file.

User nobody is not used here to avoid two easy pitfalls: Such an user should not be able to access private keys (for TLS), and should not write private keys (we would do that with Letsencrypt).
2016-05-12 15:15:32 +02:00