summaryrefslogtreecommitdiff
path: root/caddyconfig/httpcaddyfile
AgeCommit message (Collapse)Author
2020-01-22httpcaddyfile: Update directive docs; put root after rewriteMatthew Holt
2020-01-22httpcaddyfile: Get rid of 'tls off' parameter; probably not usefulMatthew Holt
2020-01-19httpcaddyfile: Fix address parsing; don't infer port at parse-timeMatthew Holt
Before, listener ports could be wrong because ParseAddress doesn't know about the user-configured HTTP/HTTPS ports, instead hard-coding port 80 or 443, which could be wrong if the user changed them to something else. Now we defer port and scheme validation/inference to a later part of building the output JSON.
2020-01-17httpcaddyfile: Move redir before rewriteMatthew Holt
Using rewrite is like saying, "I accept this request, but I just need to act on it as if it came in differently." Whereas redir implies more of, "I reject this request, send it to me differently, then I will process it." Makes sense for it to come before rewrites. This can always be changed using the 'order' global option if needed.
2020-01-16httpcaddyfile: Fix nested blocks; add handle directive; refactorMatthew Holt
The fix that was initially put forth in #2971 was good, but only for up to one layer of nesting. The real problem was that we forgot to increment nesting when already inside a block if we saw another open curly brace that opens another block (dispenser.go L157-158). The new 'handle' directive allows HTTP Caddyfiles to be designed more like nginx location blocks if the user prefers. Inside a handle block, directives are still ordered just like they are outside of them, but handler blocks at a given level of nesting are mutually exclusive. This work benefitted from some refactoring and cleanup.
2020-01-16httpcaddyfile: Replace 'handler_order' option with 'order'Matthew Holt
This allows individual directives to be ordered relative to others, where order matters (for example HTTP handlers). Will primarily be useful when developing new directives, so you don't have to modify the Caddy source code. Can also be useful if you prefer that redir comes before rewrite, for example. Note that these are global options. The route directive can be used to give a specific order to a specific group of HTTP handler directives.
2020-01-16httpcaddyfile: Group try_files routes together (#2891)Matthew Holt
This ensures that only the first matching route is used.
2020-01-15caddyfile: Sort site subroutes by key specificity, and make exclusiveMatthew Holt
In the v1 Caddyfile, only the first matching site definition would be used, so setting these `Terminal: true` ensures that only the first matching one is used in v2, too. We also have to sort by key specificity... Caddy 1 had a special data structure for selecting the most specific site definition, but we don't have that structure in v2, so we need to sort by length (of host and path, separately). For blocks where more than one key is present, we choose the longest host and path (independently, need not be from same key) by which to sort.
2020-01-10http: Remove {...query_string} placeholder, in favor of {...query}Matthew Holt
I am not sure if the query_string one is necessary or useful yet. We can always add it later if needed.
2020-01-09caddyfile: Use of vars no longer requires nesting in subroutesMatthew Holt
This is because of our sequential handling logic which was recently merged; if vars is the first handler in the chain, it will be run before the next route's matchers are executed, so there's no need to nest the handlers anymore.
2020-01-09v2: Implement Caddyfile enhancements (breaking changes) (#2960)Matt Holt
* http: path matcher: exact match by default; substring matches (#2959) This is a breaking change. * caddyfile: Change "matcher" directive to "@matcher" syntax (#2959) * cmd: Assume caddyfile adapter for config files named Caddyfile * Sub-sort handlers by path matcher length (#2959) Caddyfile-generated subroutes have handlers, which are sorted first by directive order (this is unchanged), but within directives we now sort by specificity of path matcher in descending order (longest path first, assuming that longest path is most specific). This only applies if there is only one matcher set, and the path matcher in that set has only one path in it. Path matchers with two or more paths are not sorted like this; and routes with more than one matcher set are not sorted like this either, since specificity is difficult or impossible to infer correctly. This is a special case, but definitely a very common one, as a lot of routing decisions are based on paths. * caddyfile: New 'route' directive for appearance-order handling (#2959) * caddyfile: Make rewrite directives mutually exclusive (#2959) This applies only to rewrites in the top-level subroute created by the HTTP caddyfile.
2020-01-09caddyfile: Less strict URL parsing; allows placeholdersMatthew Holt
See https://caddy.community/t/caddy-v2-reusable-snippets/6744/11?u=matt
2019-12-13tls: Ensure conn policy is created when providing certs in CaddyfileMatthew Holt
Fixes #2929
2019-12-13Couple of quick fixesMatthew Holt
2019-12-12rewrite: strip_prefix, strip_suffix, and uri_replace dirs (closes #2906)Matthew Holt
2019-12-12try_files, rewrite: allow query string in try_files (fix #2891)Matthew Holt
Also some minor cleanup/improvements discovered along the way
2019-12-10fuzz: Remove Caddyfile adapter from fuzz corpus (#2925)Matt Holt
The Caddyfile adapter does not need to be fuzzed, as all it really does is invoke the Caddyfile parser, which is already fuzzed
2019-12-10v2: Module documentation; refactor LoadModule(); new caddy struct tags (#2924)Matt Holt
This commit goes a long way toward making automated documentation of Caddy config and Caddy modules possible. It's a broad, sweeping change, but mostly internal. It allows us to automatically generate docs for all Caddy modules (including future third-party ones) and make them viewable on a web page; it also doubles as godoc comments. As such, this commit makes significant progress in migrating the docs from our temporary wiki page toward our new website which is still under construction. With this change, all host modules will use ctx.LoadModule() and pass in both the struct pointer and the field name as a string. This allows the reflect package to read the struct tag from that field so that it can get the necessary information like the module namespace and the inline key. This has the nice side-effect of unifying the code and documentation. It also simplifies module loading, and handles several variations on field types for raw module fields (i.e. variations on json.RawMessage, such as arrays and maps). I also renamed ModuleInfo.Name -> ModuleInfo.ID, to make it clear that the ID is the "full name" which includes both the module namespace and the name. This clarity is helpful when describing module hierarchy. As of this change, Caddy modules are no longer an experimental design. I think the architecture is good enough to go forward.
2019-11-29v2: fixes query matcher parsing (#2901)Mark Sargent
* fixes query matcher parsing * return correct argument error when parsing query matcher
2019-11-29http: Shorten regexp matcher placeholders; allow "=/" for simple matcherMatthew Holt
2019-11-04Prepare for beta 9 tagMatthew Holt
2019-11-04caddyfile: Fix bug with DeleteMatthew Holt
It now will delete the current token even if it is the last one
2019-10-30admin listener as opt-in for initial config (#2834)Andreas Schneider
* Always cleanup admin endpoint first * Error out if no config has been set (#2833) * Ignore explicitly missing admin config (#2833) * Separate config loading from admin initialization (#2833) * Add admin option to specify admin listener address (#2833) * Use zap for reporting admin endpoint status
2019-10-30fuzz: Don't call Load() in HTTP caddyfile adapter fuzz testsMatthew Holt
Doing so has a tendency to request certificates...
2019-10-28caddyhttp: Minor cleanup and fix nil pointer deref in caddyfile adapterMatthew Holt
2019-10-25fuzz: introduce continuous fuzzing for Caddy (#2723)Mohammed Al Sahaf
* fuzz: lay down the foundation for continuous fuzzing * improve the fuzzers and add some * fuzz: add Fuzzit badge to README & enable fuzzers submission in CI * v2-fuzz: do away with the submodule approach for fuzzers * fuzz: enable fuzzit
2019-10-10http: authentication module; hash-password cmd; http_basic providerMatthew Holt
This implements HTTP basicauth into Caddy 2. The basic auth module will not work with passwords that are not securely hashed, so a subcommand hash-password was added to make it convenient to produce those hashes. Also included is Caddyfile support. Closes #2747.
2019-10-03Add file-server and reverse-proxy subcommandsMatthew Holt
2019-09-30caddytls: Ensure automation field is not nil when appending (fix #2779)Matthew Holt
2019-09-30httpcaddyfile: Add acme_ca and email global optionsMatthew Holt
Also add ability to access options from individual unmarshalers through the Helper values
2019-09-26httpcaddyfile: Fix missing module name of storage adapterMatthew Holt
2019-09-19httpcaddyfile: Global storage configuration (closes #2758)Matthew Holt
2019-09-18httpcaddyfile: Fix nil pointer dereferenceMatthew Holt
2019-09-18host matcher: Strip [ ] from IPv6 addressesMatthew Holt
2019-09-16httpcaddyfile: static_response -> respond; minor cleanupsMatthew Holt
2019-09-13httpcaddyfile: Fix tls certificate loader module names (#2748)Matthew Holt
2019-09-11headers: New 'request_header' directive; handle Host header speciallyMatthew Holt
Before this change, only response headers could be manipulated with the Caddyfile's 'header' directive. Also handle the request Host header specially, since the Go standard library treats it separately from the other header fields...
2019-09-11httpcaddyfile: Add 'experimental_http3' optionMatthew Holt
2019-09-11httpcaddyfile: Switch order; reverse_proxy comes before php_fastcgiMatthew Holt
2019-09-10caddyfile: Improve Dispenser.NextBlock() to support nestingMatthew Holt
2019-09-10New 'php_fastcgi' directive for convenient PHP+FastCGI reverse proxyMatthew Holt
2019-08-27oops, also update the Caddyfile's {query} var to use query_stringMatthew Holt
2019-08-22caddyfile: Allow handler order to be customizedMatthew Holt
2019-08-22caddyfile: Support global config block; allow non-empty blocks w/ 0 keysMatthew Holt
2019-08-22Fix SIV where /v2 was missing from caddyfile adapter work (#2721)Mohammed Al Sahaf
2019-08-21file_server: Automatically hide all involved CaddyfilesMatthew Holt
2019-08-21Clean up Dispenser and filename handling a bitMatthew Holt
2019-08-21Implement some shorthand placeholders for CaddyfileMatthew Holt
2019-08-21Refactor Caddyfile adapter and module registrationMatthew Holt
Use piles from which to draw config values. Module values can return their name, so now we can do two-way mapping from value to name and name to value; whereas before we could only map name to value. This was problematic with the Caddyfile adapter since it receives values and needs to know the name to put in the config.
2019-08-09Implement config adapters and beginning of Caddyfile adapterMatthew Holt
Along with several other changes, such as renaming caddyhttp.ServerRoute to caddyhttp.Route, exporting some types that were not exported before, and tweaking the caddytls TLS values to be more consistent. Notably, we also now disable automatic cert management for names which already have a cert (manually) loaded into the cache. These names no longer need to be specified in the "skip_certificates" field of the automatic HTTPS config, because they will be skipped automatically.