summaryrefslogtreecommitdiffhomepage
path: root/caddyhttp
AgeCommit message (Collapse)Author
2018-05-10telemetry: Make http_user_agent a normalized fieldMatthew Holt
This way we store a short 8-byte hash of the UA instead of the full string; exactly the same way we store TLS ClientHello info.
2018-05-09Merge pull request #2079 from mholt/telemetryMatt Holt
Caddy telemetry: a global, server-side perspective of the health of the Internet
2018-05-07telemetry: Fix MITM testsMatthew Holt
2018-05-07telemetry: Record TLS ClientHellos by hash of key of structured dataMatthew Holt
Also improve handling of disabled metrics, and record TLS ClientHello in association with User-Agent
2018-04-28proxy: initialize ReverseProxy.Transport earlier and fix TCP connection leak ↵Wèi Cōngruì
(#2134)
2018-04-20Merge branch 'master' into telemetryMatthew Holt
# Conflicts: # caddy/caddymain/run.go # caddyhttp/httpserver/plugin.go # caddytls/client.go
2018-04-17proxy: Enabled configurable timeout (#2070)Tanmay Chaudhry
* Enabled configurable Timeout for the proxy directive * Added Test for reverse for proxy timeout * Removed Duplication in proxy constructors * Remove indirection from multiple constructors and refactor into one * Fix inconsistent error message and refactor dialer initialization
2018-04-14rewrite: Regular expression support for simple rule (#2082)Abiola Ibrahim
* Regexp support for simple rewrite rule * Add negate option for simplicity * ascertain explicit regexp char
2018-04-05proxy: Fix transparent pass-thru of existing X-Forwarded-For headersTheofanis Despoudis
* Fixes #1960 Transparent proxy not appending existing X-Forwarded-For header * Fixes #1960 Formatting Code
2018-04-02httpserver: Ignore ErrServerClosed when closing serverMatthew Holt
2018-03-31httpserver: Add 'supervisor' directive (#2061)Lucas Lorentz
2018-03-30httpserver: Prevent TLS client authentication bypass in 3 ways (#2099)Matt Holt
- Introduce StrictHostMatching mode for sites that require clientauth - Error if QUIC is enabled whilst TLS clientauth is configured (Our QUIC implementation does not yet support TLS clientauth, but maybe it will in the future - fixes #2095) - Error if one but not all TLS configs for the same hostname have a different ClientAuth CA pool
2018-03-30httpserver: Fix test that relies on external DNS lookupMatthew Holt
Apparently Cloudflare just caused 1.1.1.1 to resolve, so we have to change our test IP, hopefully this is better
2018-03-26log: 'except' subdirective to skip logging certain requests (#2028)Toby Allen
* proof of concept * Initial implementation with debug code * Tidy up debug code * remove unneeded import * removed extra line * Move ShouldLog function to rule entry Logger type * add tests for ShouldLog * Added tests for log exceptions * Fix logic * fix govet fail for test * Updates requested for code clarity * Update requested for style * log: Minor style tweaks to logic of log exceptions
2018-03-25Merge pull request #2072 from mholt/acmev2Matt Holt
tls: Use ACMEv2 and support automatic wildcard certificates
2018-03-25Merge branch 'master' into acmev2Matthew Holt
# Conflicts: # caddyhttp/httpserver/replacer.go # caddyhttp/httpserver/replacer_test.go
2018-03-25httpserver: CaseSensitivePath applied to paths in site keys (#2034)Denis
* different cases in path make different keys * Respect CaseSensitivePath variable when matching paths
2018-03-22Refactor diagnostics -> telemetryMatthew Holt
2018-03-21diagnostics: Add/remove metricsMatthew Holt
2018-03-18httpserver: Rework Replacer loop to ignore escaped braces (#2075)Matthew Fay
* httpserver.Replacer: Rework loop to ignore escaped placeholder braces * Fix typo and ineffectual assignment to ret * Remove redundant idxOffset declaration, simplify escape check * Add benchmark tests for new Replacer code
2018-03-17httpserver: Placeholders for tls_protocol and tls_cipher (#2062)David Somers
Also add SSL_PROTOCOL and SSL_CIPHER env vars for fastcgi. * Implement placeholders for ssl_protocol and ssl_cipher * gofmt * goimports * Housekeeping and implement as {tls_protocol} and {tls_cipher}
2018-03-17httpserver: Fix #2038 (query string being lost from URI) (#2039)Toby Allen
2018-03-17Merge branch 'master' into acmev2Matthew Holt
2018-03-17tls: Add 'wildcard' subdirective to force wildcard certificateMatthew Holt
Should only be used when many sites are defined in the Caddyfile, and you would run up against Let's Encrypt rate limits without a wildcard.
2018-03-15httpserver: Add geoip directive (closes #1819) (#2066)Andrey Blinov
* Add Geoip plugin to httpserver/plugin.go * Move GeoIP plugin higher
2018-03-14httpserver: Add a couple test cases for the Replacer on {labelN}Matthew Holt
2018-03-14httpserver: Add {labelN} placeholders for parts of hostnamesMatthew Holt
For example, {label1} would match "sub" in "sub.example.com" or whatever value is in the wildcard spot of "*.example.com". Useful for rewrite!
2018-02-21startup/shutdown: Remove deprecated startup/shutdown directives (#2033)elcore
* caddy: Remove deprecated startup/shutdown directives * caddyhttp: Remove deprecated startup/shutdown directives Users should use 'on startup' and 'on shutdown' instead.
2018-02-18httpserver: Placeholder for response header fields (#2029)Toby Allen
* Allow Response Headers in logs * Remove log line * remove unneeded log import * Check if rr is nil. Added test to check * merge if statements * remove temp file
2018-02-18basicauth: Make test pass with Go 1.10Matthew Holt
2018-02-16Fix bad merge conflict, make tests passMatthew Holt
2018-02-16Merge branch 'master' into diagnosticsMatthew Holt
# Conflicts: # plugins.go # vendor/manifest
2018-02-16httpserver: Leave %2f encoded when trimming path in site address Fix #1927 ↵Toby Allen
(#2014) * Trim path prefix using EscapedPath() * clarify comments * Added Tests for trimPathPrefix * Ensure path with trailing slash is properly trimmed * Updated tests to match prepatch behaviour * Updated tests to match prepatch behaviour * call parse on url rather than instance * add additional tests * return unmodified url if error. Additional tests
2018-02-16tls: In HTTP->HTTPS redirects, preserve redir port in some circumstancesMatthew Holt
Only strip the port from the Location URL value if the port is NOT the HTTPSPort (before, we compared against DefaultHTTPSPort instead of HTTPSPort). The HTTPSPort can be changed, but is done so for port forwarding, since in reality you can't 'change' the standard HTTPS port, you can only forward it.
2018-02-16tls: Fix HTTP->HTTPS redirects and HTTP challenge when using custom portMatthew Holt
2018-02-15httpserver: Raise error when adjusted site addresses clash at startupMatthew Holt
See discussion on #2015 for how this situation was discovered. For a Caddyfile like this: localhost { ... } :2015 { ... } Running Caddy like this: caddy -host localhost Produces two sites both defined as `localhost:2015` because the flag changes the default host value to be `localhost`. This should be an error since the sites are not distinct and it is confusing. It can also cause issues with TLS handshakes loading the wrong cert, as the linked discussion shows.
2018-02-13Merge branch 'master' into cert-cacheMatthew Holt
# Conflicts: # sigtrap_posix.go
2018-02-11fastcig: GET requests send along the body (#1975)Etienne Bruines
Fixes #1961 According to RFC 7231 and RFC 7230, there's no reason a GET-Request can't have a body (other than it possibly not being supported by existing software). It's use is simply not defined, and is left to the application.
2018-02-11staticfiles: Prevent path-based open redirectsMatthew Holt
Not a huge issue, but has security implications if OAuth tokens leaked
2018-02-10diagnostics: AppendUnique(), restructure sets, add metrics, fix bugsMatthew Holt
2018-02-08diagnostics: Implemented collection functions and create first metricsMatthew Holt
- Also implemented robust error handling and failovers - Vendored klauspost/cpuid
2018-02-04tls: Restructure and improve certificate managementMatthew Holt
- Expose the list of Caddy instances through caddy.Instances() - Added arbitrary storage to caddy.Instance - The cache of loaded certificates is no longer global; now scoped per-instance, meaning upon reload (like SIGUSR1) the old cert cache will be discarded entirely, whereas before, aggressively reloading config that added and removed lots of sites would cause unnecessary build-up in the cache over time. - Key certificates in the cache by their SHA-256 hash instead of by their names. This means certificates will not be duplicated in memory (within each instance), making Caddy much more memory-efficient for large-scale deployments with thousands of sites sharing certs. - Perform name-to-certificate lookups scoped per caddytls.Config instead of a single global lookup. This prevents certificates from stepping on each other when they overlap in their names. - Do not allow TLS configurations keyed by the same hostname to be different; this now throws an error. - Updated relevant tests, with a stark awareness that more tests are needed. - Change the NewContext function signature to include an *Instance. - Strongly recommend (basically require) use of caddytls.NewConfig() to create a new *caddytls.Config, to ensure pointers to the instance certificate cache are initialized properly. - Update the TLS-SNI challenge solver (even though TLS-SNI is disabled currently on the CA side). Store temporary challenge cert in instance cache, but do so directly by the ACME challenge name, not the hash. Modified the getCertificate function to check the cache directly for a name match if one isn't found otherwise. This will allow any caddytls.Config to be able to help solve a TLS-SNI challenge, with one extra side-effect that might actually be kind of interesting (and useless): clients could send a certificate's hash as the SNI and Caddy would be able to serve that certificate for the handshake. - Do not attempt to match a "default" (random) certificate when SNI is present but unrecognized; return no certificate so a TLS alert happens instead. - Store an Instance in the list of instances even while the instance is still starting up (this allows access to the cert cache for performing renewals at startup, etc). Will be removed from list again if instance startup fails. - Laid groundwork for ACMEv2 and Let's Encrypt wildcard support. Server type plugins will need to be updated slightly to accommodate minor adjustments to their API (like passing in an Instance). This commit includes the changes for the HTTP server. Certain Caddyfile configurations might error out with this change, if they configured different TLS settings for the same hostname. This change trades some complexity for other complexity, but ultimately this new complexity is more correct and robust than earlier logic. Fixes #1991 Fixes #1994 Fixes #1303
2018-02-02request_id: Allow reusing ID from header (closes #2012)Matthew Holt
2018-01-15proxy: Turn on KeepAlive in QuicConfig of RoundTripper (#1943)Heri Sim
* Turn on KeepAlive in QuicConfig of RoundTripper * Update reverseproxy.go
2018-01-15ResponseBuffer: add missing header writing (#1997)Tw
Signed-off-by: Tw <[email protected]>
2018-01-15template: add extension filter test and simplify test code (#1996)Tw
Signed-off-by: Tw <[email protected]>
2018-01-15browse: Correct 'modified' date alignment (#1954)magikstm
* Correct browse modified date alignment * New solution to adjust alignment
2018-01-07add basicauth {user} to replacer (#1979)Toby Allen
2017-12-23Allow Masking of IP address in Logfile. (#1930)Toby Allen
* First working mask * IP Mask working with defaults and empty * add tests for ipmask * Store Mask as setup, some tidying, cleaner flow * Prevent mask from running when directive not present * use custom replacement to store masked ip
2017-12-17Add {user} placeholder to CommonLogFormat (#1953)magikstm