summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/matchers.go
AgeCommit message (Collapse)Author
2021-02-11caddyhttp: Support placeholders in header matcher values (close #3916)Matthew Holt
2020-12-10caddyhttp: Optionally use forwarded IP for remote_ip matcherMatthew Holt
The remote_ip matcher was reading the X-Forwarded-For header by default, but this behavior was not documented in anything that was released. This is also a less secure default, as it is trivially easy to spoof request headers. Reading IPs from that header should be optional, and it should not be the default. This is technically a breaking change, but anyone relying on the undocumented behavior was just doing so by coincidence/luck up to this point since it was never in any released documentation. We'll still add a mention in the release notes about this.
2020-12-09caddyhttp: Document that remote_ip reads X-Forwarded-For headerMatthew Holt
https://caddy.community/t/remote-ip-behaviour/10762?u=matt
2020-12-09httpcaddyfile: support matching headers that do not exist (#3909)Jack Baron
* add integration test for null header matcher * implement null header matcher syntax * avoid repeating magic ! * check for field following ! character
2020-12-02caddyhttp: Optimize large host matchersMatthew Holt
2020-11-17caddyhttp: Fix header matcher when using nilMatthew Holt
Uncovered in #3807
2020-11-02caddyhttp: Merge query matchers in Caddyfile (#3839)Francis Lavoie
Also, turns out that `Add` on headers will work even if there's nothing there yet, so we can remove the condition I introduced in #3832
2020-10-31caddyhttp: Merge header matchers in Caddyfile (#3832)Francis Lavoie
2020-09-25caddyfile: Add support for `vars` and `vars_regexp` matchers (#3730)Mohammed Al Sahaf
* caddyfile: support vars and vars_regexp matchers in the caddyfile * caddyfile: matchers: Brian Kernighan said printf is good debugging tool but didn't say keep them around
2020-06-26caddyhttp: Support placeholders in query matcher (#3521)James Birtles
2020-06-16caddyhttp: Empty, not nil, query matcher matches empty query stringMatthew Holt
2020-06-16caddyhttp: Enable matching empty query stringMatthew Holt
Caddyfile syntax: query "" Or a nil matcher in the JSON should also match an empty query string. See https://caddy.community/t/v2-match-empty-query/8708?u=matt
2020-05-26caddyhttp: Refactor header matchingMatthew Holt
This allows response matchers to benefit from the same matching logic as the request header matchers (mainly prefix/suffix wildcards).
2020-05-11caddyhttp: Fix merging of Caddyfile matchers in not blocks (#3379)Francis Lavoie
2020-04-06docs: Clarify "not" matcher structure (see #3233)Matthew Holt
2020-04-06caddyhttp: Strictly forbid unnecessary blocks on matchers (#3229)Francis Lavoie
2020-04-06caddyhttp: Support single-line not matcher (#3228)Francis Lavoie
* caddyhttp: Support single-line not matcher shortcut * caddyhttp: Some tests, I guess
2020-04-01caddyhttp: Update host matcher docs about wildcardsMatthew Holt
2020-04-01caddyhttp: 'not' matcher now accepts multiple matcher sets and OR's them (#3208)Matt Holt
See https://caddy.community/t/v2-matcher-or-in-not/7355/
2020-03-30caddyhttp: Rename MatchNegate type to MatchNot typeMatthew Holt
This is more congruent with its module name. A change that affects only code, not configurations.
2020-03-24reverse_proxy: Add support for SRV backends (#3180)Matt Holt
* reverse_proxy: Begin SRV lookup support (WIP) * reverse_proxy: Finish adding support for SRV-based backends (#3179)
2020-03-19caddyhttp: Implement CEL matcher (see #3051) (#3155)Matt Holt
* caddyhttp: Implement CEL matcher (see #3051) CEL (Common Expression Language) is a very fast, flexible way to express complex logic, useful for matching requests when the conditions are not easy to express with JSON. This matcher may be considered experimental even after the 2.0 release. * Improve CEL module docs
2020-03-18caddyhttp: Minor improved Caddyfile support for some matchersMatthew Holt
Simply allows the matcher to be specified multiple times in a set which may be more convenient than one long line.
2020-03-16caddyhttp: Support path matcher of "*" without panicMatthew Holt
2020-02-27Fix typos (#3087)Success Go
* Fix typo * Fix typo, thanks for Spell Checker under VS Code
2020-02-20caddyhttp: Fixes for header and header_regexp directives (#3061)Gilbert Gilb's
* Fix crash when specifying "*" to header directive. Fixes #3060 * Look Host header in header and header_regexp. Also, if more than one header is provided, header_regexp now looks for extra headers values to reflect the behavior from header. Fixes #3059 * Fix parsing of named header_regexp in Caddyfile. See #3059
2020-02-14Minor tweaks to docs/commentsMatthew Holt
2020-02-14caddyfile: Refactor; NewFromNextSegment(); fix repeated matchersMatthew Holt
Now multiple instances of the same matcher can be used within a named matcher without overwriting previous ones.
2020-02-06Remove Starlark, for nowMatthew Holt
This is temporary as we prepare for a stable v2 release. We don't want to make promises we don't know we can keep, and the Starlark integration deserves much more focused attention which resources and funding do not currently permit. When the project is financially stable, I will be able to revisit this properly and add flexible, robust Starlark scripting support to Caddy 2.
2020-01-17caddyhttp: Improve docs, and Caddyfile for respond directiveMatthew Holt
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.
2019-12-31file-server command: Use safer defaults; http: improve host matcher docsMatthew Holt
2019-12-29Improve docs, especially w.r.t. placeholders and template actionsMatthew Holt
2019-12-29Export Replacer and use concrete type instead of interfaceMatthew Holt
The interface was only making things difficult; a concrete pointer is probably best.
2019-12-23Improve godocs all aroundMatthew Holt
These will be used in the new automated documentation system
2019-12-17http: Patch path matcher to ignore dots and spaces (#2917)Matthew Holt
(Try saying "patch path match" ten times fast)
2019-12-12Minor improvements; comments and shorter placeholders & module IDsMatthew Holt
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-28http: path matcher supports exact matching with = prefixMatthew Holt
2019-11-27http: header matcher supports fast prefix and suffix matching (#2888)Matthew Holt
2019-11-15http: Make path matcher case-insensitiveMatthew Holt
Adds tests for both the path matcher and host matcher for case insensitivity. If case sensitivity is required for the path, a regexp matcher can be used instead. This is the v2 equivalent fix of PR #2882.
2019-10-14caddyhttp: Support placeholders in MatchHost (#2810)Pascal
* Replace global placeholders in host matcher * caddyhttp: Fix panic on MatchHost tests
2019-09-30caddyhttp: 'not' matcher: Support Caddyfile unmarshalingMatthew Holt
2019-09-18host matcher: Strip [ ] from IPv6 addressesMatthew Holt
2019-09-17fastcgi: Implement / redirect for index.php with php_fastcgi directive (#2754)Matt Holt
* fastcgi: Implement / redirect for index.php with php_fastcgi directive See #2752 and https://caddy.community/t/v2-redirect-path-to-path-index-php-with-assets/6196?u=matt * caddyhttp: MatchNegate implements json.Marshaler * fastcgi: Add /index.php element to try_files matcher * fastcgi: Make /index.php redirect permanent
2019-09-14Eliminate some TODOsMatthew Holt
2019-09-10caddyfile: Improve Dispenser.NextBlock() to support nestingMatthew Holt
2019-09-06Header matchers: allow matching presence of header with empty listMatthew Holt