Commit graph

45 commits

Author SHA1 Message Date
Niko Marmeladkov
b30a0cfbae
forwardproxy: add probe_resistance_auth_external for use with external auth
Some checks failed
Build / build_caddy_with_naive (push) Has been cancelled
Add a new field ProbeResistanceAuthExternal that allows probe_resistance
to work without auth_credentials configured in forwardproxy itself.
This enables setups where authentication is handled externally (e.g. via
Caddy's forward_auth directive placed before forward_proxy in the route
order).

- New field: ProbeResistanceAuthExternal (bool)
- Provision() now skips the probe_resistance requires authentication
  check when this flag is set
- Mutually exclusive with auth_credentials
- Caddyfile subdirective: probe_resistance_auth_external
2026-06-17 17:22:33 +03:00
klzgrad
8563441787 Add Naive padding protocol v1 2025-01-18 08:20:42 +08:00
Francis Lavoie
b9def71846
Implement disable_insecure_upstreams_check (#149) 2025-01-16 11:47:57 -05:00
Francis Lavoie
c27518cc0d
Configurable idle conn counts for connection pooling (#148)
* Configurable idle conn counts for connection pooling

* Bump deps

toolchain

* Disable govulncheck (mostly noisy, misleading)

* Register directive order
2025-01-15 16:45:03 -05:00
WeidiDeng
822a51a0cf
write status then hijack (#126) 2025-01-15 07:17:41 -07:00
Mygod
02be81e696
Improve performance for ACL (#113)
This also in some sense mitigates DoS attacks by flooding servers with a lot of denied hostnames, which could lead to overloading the DNS services.

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-07-18 14:08:34 -06:00
WeidiDeng
90e3711f5b
migrate from http.Hijacker to http.NewResponseController 2024-01-19 15:06:24 +08:00
WeidiDeng
9c191f5301
migrate from http.Flusher to http.NewResponseController 2024-01-17 16:44:03 +08:00
Mygod
5b0898c8e8 Remove useless field 2023-11-05 10:04:09 -05:00
Mygod
397bfdf7c1 Merge remote-tracking branch 'origin/caddy2' into v2multiauth 2023-10-29 16:49:27 -04:00
johnzhanghua
71e3f6ebe4 fix acl_test.go test cases, restore the acl error logic to be the same as before
Signed-off-by: johnzhanghua <johnzhanghua@gmail.com>
2023-09-26 11:32:21 +10:00
Mygod
6a4bb51efc Refine error user 2023-07-21 13:57:26 -04:00
Mygod
4e71e857d9 Log invalid user as well 2023-07-19 23:43:13 -04:00
Mygod
a29f011386 Merge branch 'caddy2' into v2multiauth 2023-07-19 13:33:38 -04:00
Juan Calderon-Perez
b6d4eb85cd More linter fixes 2023-06-26 23:43:13 -04:00
Juan Calderon-Perez
3a10a41c32 Add more workflows, fix warnings from several linters 2023-06-26 23:35:38 -04:00
Juan Calderon-Perez
da96a33f48 Fix some of the gosec/golangci-lint issues 2023-06-25 00:50:44 -04:00
Juan Calderon-Perez
df7dc9533d Update dependencies, add support for Github Actions. Formatting and lint fixes 2023-06-25 00:03:20 -04:00
Mygod
8b5d75a979
Buffer http response instead of writing directly (#106) 2023-05-28 23:42:55 -06:00
Mygod
035199efd1 Add support for printing user id in log 2023-04-27 22:01:42 -04:00
Mygod
51a9bb545b Remove useless fields 2023-04-26 16:42:19 -04:00
Mygod
44bd8c758f Fix multiauth 2023-04-26 16:35:55 -04:00
klzgrad
7b288bc317
Support HTTP/3 (#80) 2021-06-07 12:06:42 -06:00
Matthew Holt
84f6867cde
Minor cleanups and tidying 2021-02-24 13:25:55 -07:00
Matthew Holt
7b5b582619
General cleanup 2020-12-04 10:15:42 -07:00
klzgrad
8d6f47b4c4
Support v2 Caddyfile (#79)
* Fix probe_resistance config parsing

* Support Caddyfile

* Support HTTP/3

* Revert "Support HTTP/3"

This reverts commit f01c163ad5145cdb0a0756345a259310b2cd50aa.

* Fix review comments

* Update README.md to new directive names

* Use Caddy 2 logger
2020-10-01 21:14:08 -06:00
單dar 于ɦʷa
03a7df4bf7
Fix misuse of sync.Pool (#76) 2020-06-20 11:21:32 -06:00
Matthew Holt
e92fe979d0 Begin refactor for Caddy 2
All the tests pass. I tried to keep as much as possible the same, but a
few things don't translate well to Caddy 2, notably one test in
probe_resist_test.go on L200, I had to change that test case since I
didn't quite understand why it was the way it was before.

Does not yet have v2 Caddyfile support.
2020-04-20 17:22:47 -06:00
sergeyfrolov
f984f4655f
Remove out-of-date comments in header 2019-08-23 22:46:36 -06:00
sergeyfrolov
05540a763b
Change caddy path to github.com/caddyserver/caddy (#63) 2019-07-06 20:35:37 -06:00
sergeyfrolov
694cbc9ec0
Add realm to Proxy-Authenticate with probe resist (#58)
In #53 we added a realm to the Proxy-Authenticate header, but the realm
only is added, when `probe_resistance` is off.
With this change, Proxy-Authenticate header will have a realm
when `probe_resistance` is on as well.
2019-05-29 12:25:55 -06:00
Sergey Frolov
ae59fae1dc Add realm to Proxy-Authenticate header
Resolves #52

Squid's default realm is "Squid proxy-caching web server",
so I decided to give descriptive realm to Caddy as well.
2019-02-03 17:23:15 -07:00
sergeyfrolov
05b2092e07
Add http.Transport + performance improvements (#47)
Add http.Transport + performance improvements
2018-08-17 17:01:52 -04:00
sergeyfrolov
27401ebe3f
Add HTTPConnectDialer for upstream requests (#41)
- HTTP/2 support with connection reuse support
 - Allows to forward client's IP
2018-07-24 17:14:51 -04:00
Sergey Frolov
3e8b65c3af Parse Host field
We stopped parsing hostname from Host field, this fixes it back.
Implicit port 80 is good not only for GET, so I changed the logic to try
port 80 on all non-connects.
While testing, I also realized that switchy omega doesn't actually presend credentials,
(somehow I thought it did), so I removed a link to it from the README.md to avoid
confusion.
Fixes #36
2018-07-03 13:09:44 -04:00
sergeyfrolov
7791846e12
Add Access Control Lists (#31)
We settled on a powerful, but a bit complicated acl design.
This commit makes a couple of cosmetic improvements. It also removes
http.Transport, which was previously used to dial and write http
requests for insecure GET requests. Now we have to dial manually,
so we can check the access control list.
2018-06-26 10:53:24 -04:00
sergeyfrolov
9ff8f882ff
Add upstream proxy support, fix tests, cosmetics (#27) 2018-06-15 16:36:08 -04:00
sergeyfrolov
91e13119f3
Set HiddenPage's Content-Type to text/html (#19)
Subsumes #16
2018-01-31 06:50:59 -07:00
Jim Ma
12605a2195 Reuse the original request, avoid the abnormal ContentLength
Fixes: abnormal ContentLength; empty schema due to the out of position check.
Handling of  HTTP GET requests: original request and URL are now reused. `generateForwardRequest()` is removed for simplicity.
2017-12-08 14:48:49 -07:00
Sergey Frolov
b4141bbbc6 gofmt 2017-11-30 12:29:35 -07:00
Sergey Frolov
f606760cc4 Add option to hide "Via" header
Partially implements #8.
2017-11-27 11:23:05 -07:00
Sergey Frolov
e1f14eab88 PAC file: configure to access localhost directly
Implements #5
2017-10-31 16:02:52 -06:00
Sergey Frolov
d9cdae3398 go vet fixes 2017-08-18 19:20:32 -04:00
Sergey Frolov
f2019d57c4 Serve PAC files from memory 2017-08-18 19:20:32 -04:00
Sergey Frolov
9e92549830 Initial commit 2017-08-18 19:20:20 -04:00