Commit Graph

1346 Commits

Author SHA1 Message Date
Matthew Holt
d2be213e10
Import paths now relative to Caddyfile (closes #867)
This is inconsistent with the other directives, but import is a special
case and frankly the behavior of import shouldn't change depending
on the directory from which you run caddy. Breaking change but I think
it's for the better, and best to do it now before 1.0.
2016-06-28 22:39:29 -06: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
Matthew Holt
5a45719227
Don't change port when TLS is managed manually 2016-06-28 18:16:10 -06:00
Viacheslav Biriukov
345ece3850 add multi proxy supprot based on urls 2016-06-28 16:35:35 -06:00
Matthew Holt
2b44a7d052
Link to instructions if storage migration fails (#902) 2016-06-27 15:13:01 -06:00
Matthew Holt
58085edc16 Don't treat localhost specially when assigning bind address
If we listen on 127.0.0.1:80 for `localhost` but :80 for everything else,
then a hostname in the hosts file that resolves to 127.0.0.1 will be
served on :80 (unless the bind directive is used) but the OS will use
the socket listening at 127.0.0.1:80, thus giving a "No such site" error
even though the site is there, but it's on the other listener at :80.

Two ways to fix this: 1) Leave as-is and require the user to set "bind
127.0.0.1" in their Caddyfile for all sites that are resolved in the
hosts file, or 2) Take out this special case and let localhost sites
listen on :80 (unless the user changes that with the bind directive, of
course). Having localhost bind to any interface is a little annoying
(unsettling?) but probably best in the long run.

https://forum.caddyserver.com/t/wildcard-virtual-domains-with-wildcard-roots/221/9?u=matt
2016-06-27 13:14:28 -06:00
Matt Holt
6f05faa670 Merge pull request #900 from hacdias/patch-2
Add filemanager directive
2016-06-27 08:32:54 -06:00
Matt Holt
eddb6f0a79 Merge pull request #905 from nesl247/hotfix/go-get-url
Fix go get url
2016-06-27 08:32:27 -06:00
Harrison Heck
70b75d1433 Fix go get url
Fixes #904
2016-06-26 14:40:13 -04:00
Matthew Holt
15fa5cf2da
OnFirstStartup and OnFinalShutdown callbacks added
OnStartup and OnShutdown callbacks now run as part of restarts, too.
The startup and shutdown directives only run their commands NOT as part
of restarts, as before. Some middleware that use OnStartup may need to
switch to OnFirstStartup and implement OnFinalShutdown to do any cleanup
as needed.
2016-06-23 18:02:12 -06:00
Henrique Dias
e74678ed43 Change hugo and filemanager order 2016-06-23 16:55:56 +01:00
Henrique Dias
d84c823855 Add filemanager directive 2016-06-23 16:03:16 +01:00
Matthew Holt
b49f65d5de
0.9 beta 2 2016-06-22 07:09:27 -06:00
Abiola Ibrahim
fd8fe24bcb Merge pull request #899 from abiosoft/master
Minor refactor for rewrite.
2016-06-22 05:49:46 +01:00
Abiola Ibrahim
281603895b Minor refactor. 2016-06-22 05:36:29 +01:00
Matthew Holt
fbad4e15c2 Fix browse template row hover effect for first row 2016-06-21 19:22:31 -06:00
Matthew Holt
ab301fec00 Fix typo, formatting 2016-06-21 19:22:31 -06:00
Pedro Nasser
deec149891 fix for new rewrite test case and add table test to replacer (#890)
* rewrite: fix new case
- added new test case and solution
- fix test case on rewrite_test

* replacer: change to table test
2016-06-21 18:44:16 -06:00
Abiola Ibrahim
9ca87cd139 Merge pull request #898 from abiosoft/master
Fix missed if_op refactor. Ensure with tests.
2016-06-21 20:52:51 +01:00
Abiola Ibrahim
cad9b3f62f Fix missed if_op refactor. Ensure with tests. 2016-06-21 20:41:09 +01:00
Matthew Holt
e585a74115
Revamped readme 2016-06-21 11:28:38 -06:00
Abiola Ibrahim
d9b6563d88 Condition upgrades (if, if_op) for rewrite, redir (#889)
* checkpoint

* Added RequestMatcher interface. Extract 'if' condition into a RequestMatcher.

* Added tests for IfMatcher

* Minor refactors

* Refactors

* Use if_op

* conform with new 0.9 beta function changes.
2016-06-21 08:59:29 -06:00
Matthew Holt
0a3f68f0d7
Fix test on Windows (with 1 CPU) 2016-06-21 00:23:18 -06:00
Matthew Holt
e625c7c051
Every package has a test 2016-06-21 00:11:55 -06:00
Matthew Holt
937654d1e0 Set host and port on address if specified via flag (fixes #888)
Also fixed a few typos and renamed caddyfile.ServerBlocks() to
caddyfile.Parse().
2016-06-20 18:25:42 -06:00
Matt Holt
33aba7eb91 Merge pull request #894 from RobbieMcKinstry/master
Refactoring to remove lint warnings
2016-06-20 18:02:27 -06:00
Robbie McKinstry
d252d40681 Refactoring to remove lint 2016-06-20 19:11:29 -04:00
Mateusz Gajewski
81c4ea6be7 Add support for Alt-Svc headers (#892) 2016-06-20 13:50:25 -06:00
Matthew Holt
1fdc46e571
Fix tests after controller refactor
The search-and-replace was a little too aggressive and I accidentally
ran tests recursively in a subdirectory instead of repo's top folder.
2016-06-20 12:29:19 -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
Matt Holt
807617965a Merge pull request #891 from andrewhamon/policy-cleanup
Refactor and clean up policy code
2016-06-20 09:27:48 -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
Pedro Nasser
6fe5c1a69f Merge pull request #885 from pedronasser/master
Fix rewrite bug with URL query + test case (#884)
2016-06-16 11:30:34 -03:00
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