Closed kraoc closed 1 year ago
Hey @kraoc I saw your issue on the caddyserver forum. I'll try to reproduce on my side and keep you updated for that.
Yeah!
If I can provide any help :)
At this time I set a new Caddy image without Souin and disable any kind of caching...
I keep looking at my conf and can't see what I did wrong... But I know there is a gap between my working Traefik and my Caddy since I have some malfunctions on my Pterodactyl panel & node... Something linked to header I think... need to investigate... but too late now :p
Can you confirm that you're not sending a Cache-Control: no-cache
or no-store
in the request headers and none of no-cache/no-store
directives are present in the response headers?
Well at a personnal level (what I setup), as I want to use Souin I never send a 'don't cache information'.
No Cache-Control: no-cache
, no-store
, even no Pragma: no-cache
:p
For my "basic" testing on https://error.zogg.fr/
I can't see any "please don't cache" information.
But there are cookie...
And I can see 'cache control' and 'csp' header 2 times.
And my x-forwarded-for
is not was I thought to find here.
Well... I'l do investigations today on all of this.
You don't even need to spend time today on this, I'll update this issue at the end of the day :)
Well... I've debug a little and everything is good now except Souin caching...
https://error.zogg.fr
still get only fwd=uri-miss
Using defer
in Caddy's header
directive avoid duplicate headers.
Still don't understand why not caching anyway...
If you have any suggestions... I can work on it to debug :)
I have just tried with nutsdb on the latest release 7cec0ec0a0df21b4696c2eb591775857a99a7881
and its broken for me too.
@kraoc can you try with release 033229a6a8842b6ebf860e98c99b57f7a37b595d
thats the only version (v1.6.17) that works for me at the moment. Everything since then is broken.
in my case its unfortunately really difficult to reproduce because I have a bunch of different reverse proxy upstreams so i havent been able to create a reproducible example yet to help
Not reverse proxing all my 53 containers... but most :) So factorize is relevant for me :) Good point on Caddy's 'import' functionnality ^^
You suggest to build my image with @v1.6.17 of Souin instead of @latest ?
Yup give this a shot, (adjust to your needs):
FROM caddy:2.6.2-builder-alpine
# Make sure souin is version locked and test everything before upgrades due to caching issues on new versions.
# DO NOT use @latest here
RUN xcaddy build --with github.com/darkweak/souin/plugins/caddy@033229a6a8842b6ebf860e98c99b57f7a37b595d \
--with github.com/darkweak/souin@033229a6a8842b6ebf860e98c99b57f7a37b595d
# See https://caddyserver.com/docs/conventions#file-locations for details
ENV XDG_CONFIG_HOME /config
ENV XDG_DATA_HOME /data
VOLUME /config
VOLUME /data
EXPOSE 80
EXPOSE 443
EXPOSE 2019
WORKDIR /srv
I don't think this is better :)
04/12/2022 17:42:15
2022/12/04 16:42:15.082 DEBUG http.stdlib http2: panic serving 172.71.130.120:41518: failed to read message: unsupported protocol version: 69
04/12/2022 17:42:15
goroutine 238 [running]:
04/12/2022 17:42:15
net/http.(*http2serverConn).runHandler.func1()
04/12/2022 17:42:15
net/http/h2_bundle.go:5904 +0x125
04/12/2022 17:42:15
panic({0x1bd9aa0, 0xc00066c460})
04/12/2022 17:42:15
runtime/panic.go:884 +0x212
04/12/2022 17:42:15
github.com/darkweak/souin/cache/providers.(*Olric).Set(0xc000312a00, {0xc003d80140, 0x3a}, {0xc0006c5800, 0x1191, 0x1800}, {{0x45d964b800}, {0xc000b08040, 0x2, 0x4}, ...}, ...)
04/12/2022 17:42:15
github.com/darkweak/souin@v1.6.17/cache/providers/olricProvider.go:119 +0x165
04/12/2022 17:42:15
github.com/darkweak/souin/rfc.(*VaryTransport).SetCache(0xc000012080, {0xc003d80140, 0x3a}, 0xc000678360)
04/12/2022 17:42:15
github.com/darkweak/souin@v1.6.17/rfc/transport.go:87 +0x244
04/12/2022 17:42:15
github.com/darkweak/souin/rfc.validateVary.func1({0x22647a0, 0xc0006706c0})
04/12/2022 17:42:15
github.com/darkweak/souin@v1.6.17/rfc/vary.go:40 +0x198
04/12/2022 17:42:15
github.com/darkweak/souin/rfc.(*cachingReadCloser).Read(0xc0006fa600, {0xc003de2e78, 0x0?, 0x188})
04/12/2022 17:42:15
github.com/darkweak/souin@v1.6.17/rfc/standalone.go:344 +0x177
04/12/2022 17:42:15
io.ReadAll({0x7f111dbc0128, 0xc0006fa600})
04/12/2022 17:42:15
io/io.go:661 +0xfe
04/12/2022 17:42:15
io/ioutil.ReadAll(...)
04/12/2022 17:42:15
io/ioutil/ioutil.go:27
04/12/2022 17:42:15
github.com/darkweak/souin/plugins.(*CustomWriter).Send(0xc0007e3ea0)
04/12/2022 17:42:15
github.com/darkweak/souin@v1.6.17/plugins/base.go:68 +0x20f
04/12/2022 17:42:15
github.com/darkweak/souin/plugins/caddy.(*SouinCaddyPlugin).ServeHTTP.func1({0x1bbf860?, 0xc0005e9680?}, 0x1eedfa7?)
04/12/2022 17:42:15
github.com/darkweak/souin/plugins/caddy@v0.0.0-20220725191448-033229a6a884/httpcache.go:138 +0x23b
04/12/2022 17:42:15
github.com/darkweak/souin/plugins.DefaultSouinPluginCallback({0x2273ce0, 0xc0007e3ea0}, 0xc0006cf500, {0x2287610?, 0xc000786360}, {0x0, 0x0}, 0xc0006a1770)
04/12/2022 17:42:15
github.com/darkweak/souin@v1.6.17/plugins/base.go:152 +0x59b
04/12/2022 17:42:15
github.com/darkweak/souin/plugins/caddy.(*SouinCaddyPlugin).ServeHTTP(0xc000682ea0, {0x2273bc0?, 0xc0008b3ef0}, 0xc0006cf000, {0x226b1e0, 0xc0008b3e60})
04/12/2022 17:42:15
github.com/darkweak/souin/plugins/caddy@v0.0.0-20220725191448-033229a6a884/httpcache.go:124 +0x6a5
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1({0x2273bc0?, 0xc0008b3ef0?}, 0x1b29601?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:290 +0x42
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0xc0008b3ce0?, {0x2273bc0?, 0xc0008b3ef0?}, 0xc000b15e18?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP({0x0?, 0xc0002b3230?}, {0x2273bc0, 0xc0008b3e00}, 0xc0006cf000, {0x226b1e0, 0xc0008b3e90})
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/headers/headers.go:110 +0x2e2
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1({0x2273bc0?, 0xc0008b3e00?}, 0x226b1e0?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:290 +0x42
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x226b1e0?, {0x2273bc0?, 0xc0008b3e00?}, 0x0?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:259 +0x3a8
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0xc000648900?, {0x2273bc0?, 0xc0008b3e00?}, 0x226b1e0?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP(0xc000312920, {0x2273bc0, 0xc0008b3e00}, 0x1b29601?, {0x226b1e0, 0xc0007e3840})
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/subroute.go:74 +0x6d
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1({0x2273bc0?, 0xc0008b3e00?}, 0x226b1e0?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:290 +0x42
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x226b1e0?, {0x2273bc0?, 0xc0008b3e00?}, 0x7?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:259 +0x3a8
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x1bbf860?, {0x2273bc0?, 0xc0008b3e00?}, 0xe?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2273bc0, 0xc0008b3e00}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:227 +0x336
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0xc0008b3ce0?, {0x2273bc0?, 0xc0008b3e00?}, 0xc000b81170?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp/headers.Handler.ServeHTTP({0x0?, 0xc000af5b78?}, {0x2279170, 0xc00030c900}, 0xc0006cf000, {0x226b1e0, 0xc0007e3b40})
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/headers/headers.go:110 +0x2e2
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1({0x2279170?, 0xc00030c900?}, 0x226b1e0?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:290 +0x42
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x226b1e0?, {0x2279170?, 0xc00030c900?}, 0x7?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2279170, 0xc00030c900}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:259 +0x3a8
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0xc0004ef800?, {0x2279170?, 0xc00030c900?}, 0x226b1e0?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Subroute).ServeHTTP(0xc0005b1420, {0x2279170, 0xc00030c900}, 0x1b29601?, {0x226b1e0, 0x1fa1af8})
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/subroute.go:74 +0x6d
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1({0x2279170?, 0xc00030c900?}, 0x226b1e0?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:290 +0x42
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0x226b1e0?, {0x2279170?, 0xc00030c900?}, 0x7f203b?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapRoute.func1.1({0x2279170, 0xc00030c900}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/routes.go:259 +0x3a8
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0xc0008e1000?, {0x2279170?, 0xc00030c900?}, 0x1da1d40?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).enforcementHandler(0x0?, {0x2279170?, 0xc00030c900?}, 0xc000290ef0?, {0x226b1e0?, 0xc0000d0be0?})
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/server.go:373 +0x252
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).wrapPrimaryRoute.func1({0x2279170?, 0xc00030c900?}, 0x4caf17?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/server.go:349 +0x3b
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0xc0005ca1a0?, {0x2279170?, 0xc00030c900?}, 0xc0006cf000?)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/caddyhttp.go:58 +0x2f
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).ServeHTTP(0xc0006fc780, {0x2279170, 0xc00030c900}, 0xc0006cf000)
04/12/2022 17:42:15
github.com/caddyserver/caddy/v2@v2.6.2/modules/caddyhttp/server.go:285 +0xb66
04/12/2022 17:42:15
net/http.serverHandler.ServeHTTP({0x6b4600?}, {0x2279170, 0xc00030c900}, 0xc0006cee00)
04/12/2022 17:42:15
net/http/server.go:2947 +0x30c
04/12/2022 17:42:15
net/http.initALPNRequest.ServeHTTP({{0x227af90?, 0xc000599e30?}, 0xc003cb2380?, {0xc0006bc2d0?}}, {0x2279170, 0xc00030c900}, 0xc0006cee00)
04/12/2022 17:42:15
net/http/server.go:3556 +0x245
04/12/2022 17:42:15
net/http.(*http2serverConn).runHandler(0x2272fc8?, 0x3177c68?, 0x0?, 0x0?)
04/12/2022 17:42:15
net/http/h2_bundle.go:5911 +0x78
04/12/2022 17:42:15
created by net/http.(*http2serverConn).processHeaders
04/12/2022 17:42:15
net/http/h2_bundle.go:5641 +0x5b9
This is how I build my image:
#!/bin/bash
# 2022-12-01
clear
cd "$(dirname "$0")" || exit 1
IMAGE_BASE=zogg/caddy
IMAGE_NAME_LATEST=${IMAGE_BASE}:latest
export DOCKER_CLI_EXPERIMENTAL=enabled
docker run --privileged --rm tonistiigi/binfmt --install all
export DOCKER_DEFAULT_PLATFORM=linux/amd64
docker buildx build --pull \
--platform=linux/amd64 \
--output=type=docker \
--build-arg TZ=Europe/Paris \
--build-arg CONCURRENCY=$(nproc) \
-t "${IMAGE_NAME_LATEST}" \
. 2>&1 | tee build.log
exit 0
# 2022-12-03
FROM --platform=linux/amd64 caddy:builder AS builder
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG BUILDPLATFORM
ARG BUILDOS
ARG BUILDARCH
ARG BUILDVARIANT
CMD ["bash"]
ENV LANG C.UTF-8
RUN xcaddy build latest \
--with github.com/caddy-dns/cloudflare@latest \
--with github.com/darkweak/souin/plugins/caddy@033229a6a8842b6ebf860e98c99b57f7a37b595d \
--with github.com/darkweak/souin@033229a6a8842b6ebf860e98c99b57f7a37b595d
# --with github.com/darkweak/souin/plugins/caddy@v1.6.17
FROM caddy:latest
ENV LANG C.UTF-8
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
Using @latest for both is better :)
No crash, only error from/to (?) Olric :
04/12/2022 17:50:24
2022/12/04 16:50:24.247 ERROR http.handlers.cache Impossible to set value into Olric, failed to read message: unsupported protocol version: 69
hmm im afraid im out of my depths here too then, only other thing I can suggest is try to use the nutsdb provider. None of the other providers work for me
It seems better than before... Caddy -> Souin -> Olric ! Fail but before I had no -> OIric...
Well let's try to be nuts :)
https://github.com/darkweak/souin/issues/279 don't use latest for olric
I switched to basic using my redis server and still miss...
(souin) {
log_level debug
allowed_http_verbs GET POST PATCH
api {
souin
}
cdn {
api_key {env.CF_DNS_API_TOKEN}
dynamic
email {env.CF_API_EMAIL}
hostname [main host]
provider cloudflare
strategy soft
}
headers Content-Type Authorization
ttl 300s
key {
disable_body
disable_host
disable_method
}
timeout {
backend 60s
cache 300ms
}
redis {
url [ip address]:6379
}
default_cache_control no-store
}
(cache) {
order cache before rewrite
cache {
import souin
}
}
{
#import logs
import debug
import cache
auto_https disable_redirects
acme_dns cloudflare {env.CF_DNS_API_TOKEN}
http_port 80
https_port 443
email {env.CF_API_EMAIL}
servers :443 {
protocols h1 h2 h3
listener_wrappers {
http_redirect
tls
}
}
servers :80 {
protocols h1 h2 h3
}
}
@error host error.zogg.fr
handle @error {
import headers
cache
reverse_proxy [ip]:[port] {
import proxy
}
}
I'm going crazy... What am I missing ?
Last log...
04/12/2022 18:45:01
2022/12/04 17:45:01.054 DEBUG http.handlers.cache Incoming request: &{Method:GET URL:/ Proto:HTTP/2.0 ProtoMajor:2 ProtoMinor:0 Header:map[Accept:[text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9] Accept-Encoding:[gzip] Accept-Language:[fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7] Cache-Control:[max-age=0] Cdn-Loop:[cloudflare] Cf-Connecting-Ip:[2a01:e0a:975:2b80:a1b7:b9e2:ed84:ab5c] Cf-Ipcountry:[FR] Cf-Ray:[77465a74ef6ff158-CDG] Cf-Visitor:[{"scheme":"https"}] Cookie:[rl_page_init_referrer=RudderEncrypt%3AU2FsdGVkX19Z1BS4SW8L%2FT61R4xNMWRKL4ZoNFAVVqQ%3D; rl_page_init_referring_domain=RudderEncrypt%3AU2FsdGVkX1%2B9jvW7sjNYaVtCN1mew4LG9P%2BGpMlNpOo%3D; _ga=GA1.1.101470646.1664808164; rl_anonymous_id=RudderEncrypt%3AU2FsdGVkX1%2BbM1RSXy0g2xoO0oKhdkm6qkz74yaPy%2BOnh9g90UG7RBuls7ZgJgcUuSrX4VsCJsuvtvexNBsNqQ%3D%3D; rl_group_id=RudderEncrypt%3AU2FsdGVkX1%2FDX4mkTxWrpuNnI6smrw7LqZK%2BMof1nAU%3D; rl_group_trait=RudderEncrypt%3AU2FsdGVkX19mlVYAs6gmpE9hkoVgKg9nXaFXd1e9QxI%3D; rl_user_id=RudderEncrypt%3AU2FsdGVkX1%2FSr0paNO3uN23ZBk9nC1Q6TUI3%2Frp0UrgDJJ7k%2B9gIoinW%2B1JqoaGhChYM5gomkTluXgqfziIP3rYYJ83xTaFLZ20iFK%2F3cTSu4RZGJAz2RXtUsgvkqpd%2FAwRfJ1JSAP2AfQ2YFs88gE8kVUZTv85FEicTXCm0RQY%3D; rl_trait=RudderEncrypt%3AU2FsdGVkX19dyqPaT8HxPvp5XXm72ZqEsgBf09kB40mkCe0Js9t9hB1q0FI3CAjqNiXxC3b973in95GeelI4DRXX6Vb%2BtyyN2lZb9YkCGLrKntPSH2Kyxzi2QY36qVIT75pj0imQUYMbQMR7NeNFdpOI7M5QTvsn%2B%2BTpcuRAb2s%3D; rl_session=RudderEncrypt%3AU2FsdGVkX1%2FOeO3Lt2nKXGRCWQLxnUOXv7XTjNKo7OmsYhAsWHpqAQqu%2B%2FufShKEh7INcWAPLvyF4j8%2BosyCh%2FiRQW5%2BEIFXBKYNO4y85XelIsyOIAznDTpRFsGcS7JeyEtZdsicSf1en95cNqBjTg%3D%3D; _ga_GS1YNQ8H2W=GS1.1.1669820552.4.1.1669821130.0.0.0; __cf_bm=.SBD6yg0tn8Kn7SeRJRUx6bTBQr3btowzAftkhUIjZk-1670175494-0-AVPFmC57lwcQHlkNME9w2mTpD80xnqhGIN/OAL/r3Mna322S69QQD+aJD8wDRsju4aV6zTdtKJ0mADyeCGhhrjVBuanawr9AgYIFdOzTk9ydPELqFYd1QI+KKll/7dEiT0/8bY8z3GHFAEpHG2vpjo0=] Date:[Sun, 04 Dec 2022 17:45:01 UTC] Dnt:[1] If-Modified-Since:[Sun, 04 Dec 2022 17:39:46 GMT] Sec-Ch-Ua:["Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"] Sec-Ch-Ua-Mobile:[?0] Sec-Ch-Ua-Platform:["Linux"] Sec-Fetch-Dest:[document] Sec-Fetch-Mode:[navigate] Sec-Fetch-Site:[none] Sec-Fetch-User:[?1] Upgrade-Insecure-Requests:[1] User-Agent:[Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36] X-Forwarded-For:[2a01:e0a:975:2b80:a1b7:b9e2:ed84:ab5c] X-Forwarded-Proto:[https]] Body:0xc0007d6cf0 GetBody:<nil> ContentLength:0 TransferEncoding:[] Close:false Host:error.zogg.fr Form:map[] PostForm:map[] MultipartForm:<nil> Trailer:map[] RemoteAddr:172.71.134.195:27528 RequestURI:/ TLS:0xc0005f40b0 Cancel:<nil> Response:<nil> ctx:0xc0007d7470}
04/12/2022 18:45:01
2022/12/04 17:45:01.355 DEBUG http.handlers.reverse_proxy selected upstream {"dial": "[ip]:[port]", "total_upstreams": 1}
04/12/2022 18:45:01
2022/12/04 17:45:01.356 DEBUG http.handlers.reverse_proxy upstream roundtrip {"upstream": "[ip]:[port]", "duration": 0.000533123, "request": {"remote_ip": "172.71.134.195", "remote_port": "27528", "proto": "HTTP/2.0", "method": "GET", "host": "error.zogg.fr", "uri": "/", "headers": {"Accept-Encoding": ["gzip"], "Cookie": [], "Sec-Ch-Ua-Platform": ["\"Linux\""], "If-Modified-Since": ["Sun, 04 Dec 2022 17:39:46 GMT"], "X-Forwarded-Host": ["error.zogg.fr"], "Dnt": ["1"], "X-Powered-By": ["Zogg"], "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"], "Cf-Connecting-Ip": ["2a01:e0a:975:2b80:a1b7:b9e2:ed84:ab5c"], "Cf-Ipcountry": ["FR"], "Sec-Fetch-Dest": ["document"], "Date": ["Sun, 04 Dec 2022 17:45:01 UTC"], "Sec-Ch-Ua": ["\"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\""], "X-Real-Ip": ["error.zogg.fr"], "Content-Security-Policy": ["default-src data: blob: 'self' 'unsafe-inline' 'unsafe-eval' wss: https:"], "X-Forwarded-Proto": ["https"], "Upgrade-Insecure-Requests": ["1"], "Cdn-Loop": ["cloudflare"], "Sec-Fetch-User": ["?1"], "Sec-Fetch-Mode": ["navigate"], "Accept-Language": ["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7"], "Server": ["Caddy"], "X-Forwarded-For": ["error.zogg.fr"], "Cache-Control": ["public, max-age=86400, s-maxage=86400, max-stale=3600, stale-while-revalidate=86400, stale-if-error=86400"], "Sec-Fetch-Site": ["none"], "User-Agent": ["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"], "Cf-Visitor": ["{\"scheme\":\"https\"}"], "Cf-Ray": ["77465a74ef6ff158-CDG"], "Sec-Ch-Ua-Mobile": ["?0"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "h2", "server_name": "error.zogg.fr"}}, "headers": {"Server": ["nginx"], "Date": ["Sun, 04 Dec 2022 17:45:01 GMT"], "X-Xss-Protection": ["1; mode=block"], "X-Frame-Options": ["SAMEORIGIN"], "Last-Modified": ["Sun, 04 Dec 2022 17:39:46 GMT"], "Connection": ["keep-alive"], "Etag": ["\"638cdb62-20ac\""], "X-Content-Type-Options": ["nosniff"], "Strict-Transport-Security": ["max-age=63072000"]}, "status": 304}
04/12/2022 18:45:08
2022/12/04 17:45:08.378 DEBUG http.handlers.reverse_proxy selected upstream {"dial": "[ip]:[port]", "total_upstreams": 1}
04/12/2022 18:45:08
2022/12/04 17:45:08.379 DEBUG http.handlers.reverse_proxy upstream roundtrip {"upstream": "[ip]:[port]", "duration": 0.000523909, "request": {"remote_ip": "172.71.134.195", "remote_port": "27528", "proto": "HTTP/2.0", "method": "GET", "host": "error.zogg.fr", "uri": "/", "headers": {"User-Agent": ["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"], "Cf-Ipcountry": ["FR"], "Dnt": ["1"], "X-Real-Ip": ["error.zogg.fr"], "Cf-Visitor": ["{\"scheme\":\"https\"}"], "X-Forwarded-Proto": ["https"], "X-Forwarded-Host": ["error.zogg.fr"], "Accept-Language": ["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7"], "Cookie": [], "Sec-Fetch-User": ["?1"], "Sec-Fetch-Site": ["none"], "Cache-Control": ["public, max-age=86400, s-maxage=86400, max-stale=3600, stale-while-revalidate=86400, stale-if-error=86400"], "Sec-Ch-Ua-Platform": ["\"Linux\""], "Server": ["Caddy"], "Cf-Connecting-Ip": ["2a01:e0a:975:2b80:a1b7:b9e2:ed84:ab5c"], "Sec-Ch-Ua-Mobile": ["?0"], "Cdn-Loop": ["cloudflare"], "Content-Security-Policy": ["default-src data: blob: 'self' 'unsafe-inline' 'unsafe-eval' wss: https:"], "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"], "X-Forwarded-For": ["error.zogg.fr"], "Pragma": ["no-cache"], "Accept-Encoding": ["gzip"], "Upgrade-Insecure-Requests": ["1"], "Cf-Ray": ["77465aa34c2af158-CDG"], "Sec-Fetch-Mode": ["navigate"], "X-Powered-By": ["Zogg"], "Sec-Ch-Ua": ["\"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"108\", \"Google Chrome\";v=\"108\""], "Sec-Fetch-Dest": ["document"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "h2", "server_name": "error.zogg.fr"}}, "headers": {"Server": ["nginx"], "Date": ["Sun, 04 Dec 2022 17:45:08 GMT"], "Content-Type": ["text/html"], "Connection": ["keep-alive"], "Etag": ["W/\"638cdb62-20ac\""], "Last-Modified": ["Sun, 04 Dec 2022 17:39:46 GMT"], "X-Content-Type-Options": ["nosniff"], "Content-Encoding": ["gzip"], "X-Xss-Protection": ["1; mode=block"], "Vary": ["Accept-Encoding"], "X-Frame-Options": ["SAMEORIGIN"], "Strict-Transport-Security": ["max-age=63072000"]}, "status": 200}
Browser console:
cache-status: Souin; fwd=uri-miss
I give Souin some days to test & debug and if no result... I switch back to Varnish :(
My home internet connection need some cachine for my homelab :p
I didn't have time to debug yet. I'll have a look a that issue tonight.
Anyway anyhow if I can provide more logs... please ask :p
Well, I don't know if that could be related but did you declare the cache directive in the global options?
About olric, this minimal caddyfile works
{
order cache before rewrite
cache
}
:81 {
cache {
olric {
url 127.0.0.1:3320
}
}
respond "Hello world"
}
That configuration works
(souin) {
log_level debug
allowed_http_verbs GET POST PATCH
api {
souin
}
headers Content-Type Authorization
ttl 300s
key {
disable_body
disable_host
disable_method
}
timeout {
backend 60s
cache 300ms
}
redis {
url localhost:6379
}
default_cache_control no-store
}
(cache) {
order cache before rewrite
cache {
import souin
}
}
# Global headers
(headersGlobal) {
Server "Caddy"
X-Powered-By "Zogg"
X-Server "Caddy"
}
# Security headers
(headersSecurity) {
# Keep referrer data off of HTTP connections
Referrer-Policy "strict-origin-when-cross-origin"
# Enable HSTS
Strict-Transport-Security "max-age=63072000, includeSubDomains, preload"
X-Permitted-Cross-Domain-Policies: "none"
# Disable clients from sniffing the media type
X-Content-Type-Options "nosniff"
# Clickjacking protection
X-Frame-Options "SAMEORIGIN"
# Disable XSS protection
X-XSS-Protection 0
# Permissions
Permissions-Policy "vibrate=(self), geolocation=(self), midi=(self), notifications=(self), push=(self), microphone=(self), camera=(self), magnetometer=(self), gyroscope=(self), fullscreen=(self), payment=(self)"
# CSP
Content-Security-Policy "default-src 'self' *.zogg.fr data: wss: blob: https:; script-src 'self' 'unsafe-eval' 'unsafe-inline' *.zogg.fr data: blob: https:; img-src 'self' data: blob: *.zogg.Fr https:;style-src 'self' 'unsafe-inline' *.zogg.fr https:; connect-src 'self' wss: *.zogg.fr https:; frame-src 'self' https:; frame-ancestors 'self' *.zogg.fr"
}
(headersRobots) {
# Robots
X-Robots-Tag "none,noarchive,nosnippet,notranslate,noimageindex"
}
(headersCaching) {
# Caching
Cache-Control "public, max-age=86400, s-maxage=86400, max-stale=3600, stale-while-revalidate=86400, stale-if-error=86400"
header_up Cache-Control "public, max-age=86400, s-maxage=86400, max-stale=3600, stale-while-revalidate=86400, stale-if-error=86400"
}
(headers) {
header {
import headersGlobal
import headersRobots
import headersCaching
import headersSecurity
}
}
{
import cache
auto_https disable_redirects
http_port 80
https_port 443
servers :80 {
protocols h1 h2 h3
}
}
localhost:443 {
import headers
cache
respond "Hello world"
}
I tried to set "like yours" and still: fwd=uri-miss
Here's my complete Caddyfile:
# 2022-12-04
(logs) {
log {
level error
}
}
(debug) {
debug
log {
level debug
}
}
(souin) {
log_level debug
allowed_http_verbs GET POST PATCH
api {
souin
}
headers Content-Type Authorization
ttl 300s
key {
disable_body
disable_host
disable_method
}
timeout {
backend 60s
cache 300ms
}
redis {
url 192.168.50.202:6379
}
default_cache_control no-store
}
(cache) {
order cache before rewrite
cache {
import souin
}
}
{
import cache
#import logs
import debug
auto_https disable_redirects
acme_dns cloudflare {env.CF_DNS_API_TOKEN}
http_port 80
https_port 443
email {env.CF_API_EMAIL}
servers :443 {
protocols h1 h2 h3
listener_wrappers {
http_redirect
tls
}
}
servers :80 {
protocols h1 h2 h3
}
}
# Cloudflare
(trustedproxies) {
trusted_proxies 10.0.0.0/8 172.16.0.0/16 192.168.0.0/16 fc00::/7 173.245.48.0/20 103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 141.101.64.0/18 108.162.192.0/18 190.93.240.0/20 188.114.96.0/20 197.234.240.0/22
}
(cloudflare) {
tls {
dns cloudflare {env.CF_DNS_API_TOKEN}
resolvers 1.1.1.1 1.0.0.1
}
header {
header_up Host {upstream_hostport}
header_up X-Forwarded-Proto {scheme}
header_up X-Forwarded-For {http.request.header.CF-Connecting-IP}
defer
}
}
(headerCacheControl) {
header_up Cache-Control "public, max-age=86400, s-maxage=86400, max-stale=3600, stale-while-revalidate=86400, stale-if-error=86400"
header_down Cache-Control "public, max-age=86400, s-maxage=86400, max-stale=3600, stale-while-revalidate=86400, stale-if-error=86400"
}
(proxy) {
import trustedproxies
import headerCacheControl
header_up X-Powered-By "Zogg"
header_down X-Powered-By "Zogg"
header_up Host {host}
header_down Host {host}
header_up X-Real-IP {host}
header_down X-Real-IP {host}
header_up X-Forwarded-For {host}
header_down X-Forwarded-For {host}
header_up Content-Security-Policy "default-src data: blob: 'self' 'unsafe-inline' 'unsafe-eval' wss: https:"
header_down Content-Security-Policy "default-src data: blob: 'self' 'unsafe-inline' 'unsafe-eval' wss: https:"
}
# Global headers
(headersGlobal) {
X-Powered-By "Zogg"
-Server
}
# Security headers
(headersSecurity) {
# Keep referrer data off of HTTP connections
Referrer-Policy "strict-origin-when-cross-origin"
# Enable HSTS
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
X-Permitted-Cross-Domain-Policies: "none"
# Disable clients from sniffing the media type
X-Content-Type-Options "nosniff"
# Clickjacking protection
X-Frame-Options "SAMEORIGIN"
# Disable XSS protection
X-XSS-Protection 0
# Permissions
Permissions-Policy "fullscreen=(*), display-capture=(self), accelerometer=(), battery=(), camera=(), autoplay=(self), vibrate=(self), geolocation=(self), midi=(self), notifications=(*), push=(*), microphone=(self), magnetometer=(self), gyroscope=(self), payment=(self)"
# CSP
Content-Security-Policy "default-src data: blob: wss: 'self' 'unsafe-inline' 'unsafe-eval' https:"
}
(headersRobots) {
# Robots
X-Robots-Tag "none,noarchive,nosnippet,notranslate,noimageindex"
}
(headersCaching) {
Cache-Control "public, max-age=86400, s-maxage=86400, max-stale=3600, stale-while-revalidate=86400, stale-if-error=86400"
import headerCacheControl
}
(headers) {
header {
import headersGlobal
import headersRobots
import headersCaching
import headersSecurity
defer
}
}
(pterodadctyl) {
import headers
header {
Sec-Fetch-Site "cross-site"
X-Forwarded-Proto "https"
Access-Control-Allow-Headers "*, Authorization"
defer
}
}
(matrix) {
header "/.well-known/matrix/*" Content-Type application/json
header "/.well-known/matrix/*" Access-Control-Allow-Origin "*"
respond /.well-known/matrix/server {"m.server":"matrix.zogg.fr:8448"}
respond /.well-known/matrix/client {"m.homeserver":{"base_url":"https://matrix.zogg.fr"}}
}
import /etc/caddy/conf/entries
And how I handle my error.zogg.fr with your setup :
# 2022-12-04
@error host error.zogg.fr
handle @error {
import headers
cache
#reverse_proxy 192.168.50.202:2080 {
# import proxy
#}
respond "Hello world"
}
Here's my caddy logs after a page refresh :
05/12/2022 8:08:58
2022/12/05 07:08:58.158 INFO using provided configuration {"config_file": "/etc/caddy/Caddyfile", "config_adapter": "caddyfile"}
05/12/2022 8:08:58
2022/12/05 07:08:58.187 WARN caddyfile Unnecessary header_up X-Forwarded-Proto: the reverse proxy's default behavior is to pass headers to the upstream
05/12/2022 8:08:58
2022/12/05 07:08:58.187 WARN caddyfile Unnecessary header_up X-Forwarded-Proto: the reverse proxy's default behavior is to pass headers to the upstream
05/12/2022 8:08:58
2022/12/05 07:08:58.189 WARN caddyfile Unnecessary header_up X-Forwarded-Proto: the reverse proxy's default behavior is to pass headers to the upstream
05/12/2022 8:08:58
2022/12/05 07:08:58.193 WARN Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies {"adapter": "caddyfile", "file": "/etc/caddy/Caddyfile", "line": 39}
05/12/2022 8:08:58
2022/12/05 07:08:58.201 INFO admin admin endpoint started {"address": "localhost:2019", "enforce_origin": false, "origins": ["//localhost:2019", "//[::1]:2019", "//127.0.0.1:2019"]}
05/12/2022 8:08:58
2022/12/05 07:08:58.202 INFO http server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "srv0", "https_port": 443}
05/12/2022 8:08:58
2022/12/05 07:08:58.202 WARN http automatic HTTP->HTTPS redirects are disabled {"server_name": "srv0"}
05/12/2022 8:08:58
2022/12/05 07:08:58.202 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc00041aa80"}
05/12/2022 8:08:58
2022/12/05 07:08:58.210 DEBUG http.handlers.cache Provider initialized.
05/12/2022 8:08:58
2022/12/05 07:08:58.213 DEBUG http.handlers.cache Transport initialized.
05/12/2022 8:08:58
2022/12/05 07:08:58.213 DEBUG http.handlers.cache Set Souin as Cache-Status name
05/12/2022 8:08:58
2022/12/05 07:08:58.213 DEBUG http.handlers.cache Enable GraphQL logic due to your custom HTTP verbs setup.
05/12/2022 8:08:58
2022/12/05 07:08:58.213 DEBUG http.handlers.cache Allow 3 method(s). [GET POST PATCH].
05/12/2022 8:08:58
2022/12/05 07:08:58.213 INFO http.handlers.cache Set backend timeout to 1m0s
05/12/2022 8:08:58
2022/12/05 07:08:58.213 INFO http.handlers.cache Set cache timeout to 1m0s
05/12/2022 8:08:58
2022/12/05 07:08:58.213 INFO http.handlers.cache Souin configuration is now loaded.
05/12/2022 8:08:58
2022/12/05 07:08:58.214 INFO http enabling HTTP/3 listener {"addr": ":443"}
05/12/2022 8:08:58
2022/12/05 07:08:58.214 DEBUG http starting server loop {"address": "[::]:443", "tls": true, "http3": true}
05/12/2022 8:08:58
2022/12/05 07:08:58.214 INFO http.log server running {"name": "srv0", "protocols": ["h1", "h2", "h3"]}
05/12/2022 8:08:58
2022/12/05 07:08:58.214 INFO http enabling automatic TLS certificate management {"domains": ["*.zogg.fr"]}
05/12/2022 8:08:58
2022/12/05 07:08:58.218 DEBUG tls loading managed certificate {"domain": "*.zogg.fr", "expiration": "2023/03/04 08:46:38.000", "issuer_key": "acme-v02.api.letsencrypt.org-directory", "storage": "FileStorage:/data/caddy"}
05/12/2022 8:08:58
2022/12/05 07:08:58.219 DEBUG tls.cache added certificate to cache {"subjects": ["*.zogg.fr"], "expiration": "2023/03/04 08:46:38.000", "managed": true, "issuer_key": "acme-v02.api.letsencrypt.org-directory", "hash": "6ce9e9ab5ef53dc587fa7d3bae244ad8341837427574bb017ef34eaf4564c0d3", "cache_size": 1, "cache_capacity": 10000}
05/12/2022 8:08:58
2022/12/05 07:08:58.219 DEBUG events event {"name": "cached_managed_cert", "id": "d47fae0d-b03b-46f4-b970-aae92f30e5a5", "origin": "tls", "data": {"sans":["*.zogg.fr"]}}
05/12/2022 8:08:58
2022/12/05 07:08:58.220 INFO tls cleaning storage unit {"description": "FileStorage:/data/caddy"}
05/12/2022 8:08:58
2022/12/05 07:08:58.229 INFO autosaved config (load with --resume flag) {"file": "/config/caddy/autosave.json"}
05/12/2022 8:08:58
2022/12/05 07:08:58.229 INFO serving initial configuration
05/12/2022 8:08:58
2022/12/05 07:08:58.313 INFO tls finished cleaning storage units
05/12/2022 8:09:01
2022/12/05 07:09:01.679 DEBUG events event {"name": "tls_get_certificate", "id": "f28fc54f-cc4d-4e1e-89f8-68c0688bf6e0", "origin": "tls", "data": {"client_hello":{"CipherSuites":[4866,4867,4865,49195,49196,49199,49200,49171,49192,156,157,47,53,10,255],"ServerName":"error.zogg.fr","SupportedCurves":[29,23,30,25,24],"SupportedPoints":"AAEC","SignatureSchemes":[1027,1283,1539,2055,2056,2057,2058,2059,2052,2053,2054,1025,1281,1537,771,515,769,513,770,514,1026,1282,1538],"SupportedProtos":["h2","http/1.1"],"SupportedVersions":[772,771,770,769],"Conn":{"Conn":{}}}}}
05/12/2022 8:09:01
2022/12/05 07:09:01.679 DEBUG tls.handshake no matching certificates and no custom selection logic {"identifier": "error.zogg.fr"}
05/12/2022 8:09:01
2022/12/05 07:09:01.679 DEBUG tls.handshake choosing certificate {"identifier": "*.zogg.fr", "num_choices": 1}
05/12/2022 8:09:01
2022/12/05 07:09:01.679 DEBUG tls.handshake default certificate selection results {"identifier": "*.zogg.fr", "subjects": ["*.zogg.fr"], "managed": true, "issuer_key": "acme-v02.api.letsencrypt.org-directory", "hash": "6ce9e9ab5ef53dc587fa7d3bae244ad8341837427574bb017ef34eaf4564c0d3"}
05/12/2022 8:09:01
2022/12/05 07:09:01.679 DEBUG tls.handshake matched certificate in cache {"remote_ip": "172.71.134.152", "remote_port": "58212", "subjects": ["*.zogg.fr"], "managed": true, "expiration": "2023/03/04 08:46:38.000", "hash": "6ce9e9ab5ef53dc587fa7d3bae244ad8341837427574bb017ef34eaf4564c0d3"}
05/12/2022 8:09:03
2022/12/05 07:09:03.238 DEBUG http.handlers.cache Incoming request: &{Method:GET URL:/ Proto:HTTP/2.0 ProtoMajor:2 ProtoMinor:0 Header:map[Accept:[text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9] Accept-Encoding:[gzip] Accept-Language:[fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7] Cache-Control:[max-age=0] Cdn-Loop:[cloudflare] Cf-Connecting-Ip:[2a01:e0a:975:2b80:a1b7:b9e2:ed84:ab5c] Cf-Ipcountry:[FR] Cf-Ray:[774af43f2a69229c-CDG] Cf-Visitor:[{"scheme":"https"}] Cookie:[rl_page_init_referrer=RudderEncrypt%3AU2FsdGVkX19Z1BS4SW8L%2FT61R4xNMWRKL4ZoNFAVVqQ%3D; rl_page_init_referring_domain=RudderEncrypt%3AU2FsdGVkX1%2B9jvW7sjNYaVtCN1mew4LG9P%2BGpMlNpOo%3D; _ga=GA1.1.101470646.1664808164; rl_anonymous_id=RudderEncrypt%3AU2FsdGVkX1%2BbM1RSXy0g2xoO0oKhdkm6qkz74yaPy%2BOnh9g90UG7RBuls7ZgJgcUuSrX4VsCJsuvtvexNBsNqQ%3D%3D; rl_group_id=RudderEncrypt%3AU2FsdGVkX1%2FDX4mkTxWrpuNnI6smrw7LqZK%2BMof1nAU%3D; rl_group_trait=RudderEncrypt%3AU2FsdGVkX19mlVYAs6gmpE9hkoVgKg9nXaFXd1e9QxI%3D; rl_user_id=RudderEncrypt%3AU2FsdGVkX1%2FSr0paNO3uN23ZBk9nC1Q6TUI3%2Frp0UrgDJJ7k%2B9gIoinW%2B1JqoaGhChYM5gomkTluXgqfziIP3rYYJ83xTaFLZ20iFK%2F3cTSu4RZGJAz2RXtUsgvkqpd%2FAwRfJ1JSAP2AfQ2YFs88gE8kVUZTv85FEicTXCm0RQY%3D; rl_trait=RudderEncrypt%3AU2FsdGVkX19dyqPaT8HxPvp5XXm72ZqEsgBf09kB40mkCe0Js9t9hB1q0FI3CAjqNiXxC3b973in95GeelI4DRXX6Vb%2BtyyN2lZb9YkCGLrKntPSH2Kyxzi2QY36qVIT75pj0imQUYMbQMR7NeNFdpOI7M5QTvsn%2B%2BTpcuRAb2s%3D; rl_session=RudderEncrypt%3AU2FsdGVkX1%2FOeO3Lt2nKXGRCWQLxnUOXv7XTjNKo7OmsYhAsWHpqAQqu%2B%2FufShKEh7INcWAPLvyF4j8%2BosyCh%2FiRQW5%2BEIFXBKYNO4y85XelIsyOIAznDTpRFsGcS7JeyEtZdsicSf1en95cNqBjTg%3D%3D; _ga_GS1YNQ8H2W=GS1.1.1669820552.4.1.1669821130.0.0.0; __cf_bm=7e6QU0cRp68dgFDZfBbVJgHE3wuUf1rS2DW37PhRMB0-1670223078-0-AUHYYGFw1K2Fyc5ubkbwJA/+wNBqIqxHGlGJJJ+JG9iZoVXbUBjoEMDaCU/WH6pzCR7Y5ZYVKy5yIqSUZ7/VWd4jGVID4rZNM/7jqhwDyNwEOEyU2ekE5V/pO+xzY9XZo+piVQV5aaCXg+LmmEeUEe8=] Date:[Mon, 05 Dec 2022 07:09:03 UTC] Dnt:[1] Referer:[https://error.zogg.fr/] Sec-Ch-Ua:["Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"] Sec-Ch-Ua-Mobile:[?0] Sec-Ch-Ua-Platform:["Linux"] Sec-Fetch-Dest:[document] Sec-Fetch-Mode:[navigate] Sec-Fetch-Site:[same-origin] Sec-Fetch-User:[?1] Upgrade-Insecure-Requests:[1] User-Agent:[Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36] X-Forwarded-For:[2a01:e0a:975:2b80:a1b7:b9e2:ed84:ab5c] X-Forwarded-Proto:[https]] Body:0xc000382330 GetBody:<nil> ContentLength:0 TransferEncoding:[] Close:false Host:error.zogg.fr Form:map[] PostForm:map[] MultipartForm:<nil> Trailer:map[] RemoteAddr:172.71.134.152:58212 RequestURI:/ TLS:0xc00067b600 Cancel:<nil> Response:<nil> ctx:0xc000383f20}
And my browser console log:
General:
Request URL: https://error.zogg.fr/
Request Method: GET
Status Code: 200
Remote Address: [2606:4700:3033::6815:381b]:443
Referrer Policy: same-origin
Response Headers
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
cache-control: public, max-age=86400, s-maxage=86400, max-stale=3600, stale-while-revalidate=86400, stale-if-error=86400
cache-status: Souin; fwd=uri-miss
cf-cache-status: DYNAMIC
cf-ray: 774af43f2a69229c-CDG
content-length: 11
content-security-policy: default-src data: blob: wss: 'self' 'unsafe-inline' 'unsafe-eval' https:
content-type: text/plain; charset=utf-8
date: Mon, 05 Dec 2022 07:09:03 GMT
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
permissions-policy: fullscreen=(*), display-capture=(self), accelerometer=(), battery=(), camera=(), autoplay=(self), vibrate=(self), geolocation=(self), midi=(self), notifications=(*), push=(*), microphone=(self), magnetometer=(self), gyroscope=(self), payment=(self)
referrer-policy: strict-origin-when-cross-origin
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=rRuxvQPvTcw762WSUjzGYwZLFg%2BwyHA56wbG3hywcOsvSKRpJF%2BMjEBJ7Knz%2F6N9dfpIOfoCG9UNzPFgrnptZZTA4z17pAHe55KDYjcl245RNxPIu7KccAM6AUZ26GfFWCN322nSyaH6VBQE"}],"group":"cf-nel","max_age":604800}
server: cloudflare
strict-transport-security: max-age=15552000; includeSubDomains; preload
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-powered-by: Zogg
x-robots-tag: none,noarchive,nosnippet,notranslate,noimageindex
x-xss-protection: 0
Request Headers
:authority: error.zogg.fr
:method: GET
:path: /
:scheme: https
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
accept-encoding: gzip, deflate, br
accept-language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7
cache-control: max-age=0
cookie: rl_page_init_referrer=RudderEncrypt%3AU2FsdGVkX19Z1BS4SW8L%2FT61R4xNMWRKL4ZoNFAVVqQ%3D; rl_page_init_referring_domain=RudderEncrypt%3AU2FsdGVkX1%2B9jvW7sjNYaVtCN1mew4LG9P%2BGpMlNpOo%3D; _ga=GA1.1.101470646.1664808164; rl_anonymous_id=RudderEncrypt%3AU2FsdGVkX1%2BbM1RSXy0g2xoO0oKhdkm6qkz74yaPy%2BOnh9g90UG7RBuls7ZgJgcUuSrX4VsCJsuvtvexNBsNqQ%3D%3D; rl_group_id=RudderEncrypt%3AU2FsdGVkX1%2FDX4mkTxWrpuNnI6smrw7LqZK%2BMof1nAU%3D; rl_group_trait=RudderEncrypt%3AU2FsdGVkX19mlVYAs6gmpE9hkoVgKg9nXaFXd1e9QxI%3D; rl_user_id=RudderEncrypt%3AU2FsdGVkX1%2FSr0paNO3uN23ZBk9nC1Q6TUI3%2Frp0UrgDJJ7k%2B9gIoinW%2B1JqoaGhChYM5gomkTluXgqfziIP3rYYJ83xTaFLZ20iFK%2F3cTSu4RZGJAz2RXtUsgvkqpd%2FAwRfJ1JSAP2AfQ2YFs88gE8kVUZTv85FEicTXCm0RQY%3D; rl_trait=RudderEncrypt%3AU2FsdGVkX19dyqPaT8HxPvp5XXm72ZqEsgBf09kB40mkCe0Js9t9hB1q0FI3CAjqNiXxC3b973in95GeelI4DRXX6Vb%2BtyyN2lZb9YkCGLrKntPSH2Kyxzi2QY36qVIT75pj0imQUYMbQMR7NeNFdpOI7M5QTvsn%2B%2BTpcuRAb2s%3D; rl_session=RudderEncrypt%3AU2FsdGVkX1%2FOeO3Lt2nKXGRCWQLxnUOXv7XTjNKo7OmsYhAsWHpqAQqu%2B%2FufShKEh7INcWAPLvyF4j8%2BosyCh%2FiRQW5%2BEIFXBKYNO4y85XelIsyOIAznDTpRFsGcS7JeyEtZdsicSf1en95cNqBjTg%3D%3D; _ga_GS1YNQ8H2W=GS1.1.1669820552.4.1.1669821130.0.0.0; __cf_bm=7e6QU0cRp68dgFDZfBbVJgHE3wuUf1rS2DW37PhRMB0-1670223078-0-AUHYYGFw1K2Fyc5ubkbwJA/+wNBqIqxHGlGJJJ+JG9iZoVXbUBjoEMDaCU/WH6pzCR7Y5ZYVKy5yIqSUZ7/VWd4jGVID4rZNM/7jqhwDyNwEOEyU2ekE5V/pO+xzY9XZo+piVQV5aaCXg+LmmEeUEe8=
dnt: 1
referer: https://error.zogg.fr/
sec-ch-ua: "Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Linux"
sec-fetch-dest: document
sec-fetch-mode: navigate
sec-fetch-site: same-origin
sec-fetch-user: ?1
upgrade-insecure-requests: 1
user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
I have no more logs for debugging...
If you can find what's wrong in this ?
As all related to "not using cache" is working...
Thank you!!
Well... I put back to "no logs" in my conf, then put back my reverse proxy in 'error', restart Caddy, refresh the page and get :
Souin; fwd=uri-miss; stored
All subsequent page refresh get:
Souin; fwd=uri-miss
Here is what I did locally to test on another way:
(souin) {
log_level debug
allowed_http_verbs GET POST PATCH
api {
souin
}
headers Content-Type Authorization
ttl 300s
key {
disable_body
disable_host
disable_method
}
timeout {
backend 60s
cache 300ms
}
redis {
url localhost:6379
}
default_cache_control no-store
}
(cache) {
order cache before rewrite
cache {
import souin
}
}
# Global headers
(headersGlobal) {
Server "Caddy"
X-Powered-By "Zogg"
X-Server "Caddy"
}
# Security headers
(headersSecurity) {
# Keep referrer data off of HTTP connections
Referrer-Policy "strict-origin-when-cross-origin"
# Enable HSTS
Strict-Transport-Security "max-age=63072000, includeSubDomains, preload"
X-Permitted-Cross-Domain-Policies: "none"
# Disable clients from sniffing the media type
X-Content-Type-Options "nosniff"
# Clickjacking protection
X-Frame-Options "SAMEORIGIN"
# Disable XSS protection
X-XSS-Protection 0
# Permissions
Permissions-Policy "vibrate=(self), geolocation=(self), midi=(self), notifications=(self), push=(self), microphone=(self), camera=(self), magnetometer=(self), gyroscope=(self), fullscreen=(self), payment=(self)"
# CSP
Content-Security-Policy "default-src 'self' *.zogg.fr data: wss: blob: https:; script-src 'self' 'unsafe-eval' 'unsafe-inline' *.zogg.fr data: blob: https:; img-src 'self' data: blob: *.zogg.Fr https:;style-src 'self' 'unsafe-inline' *.zogg.fr https:; connect-src 'self' wss: *.zogg.fr https:; frame-src 'self' https:; frame-ancestors 'self' *.zogg.fr"
}
(headersRobots) {
# Robots
X-Robots-Tag "none,noarchive,nosnippet,notranslate,noimageindex"
}
(headersCaching) {
# Caching
Cache-Control "public, max-age=86400, s-maxage=86400, max-stale=3600, stale-while-revalidate=86400, stale-if-error=86400"
header_up Cache-Control "public, max-age=86400, s-maxage=86400, max-stale=3600, stale-while-revalidate=86400, stale-if-error=86400"
}
(headers) {
header {
import headersGlobal
import headersRobots
import headersCaching
import headersSecurity
}
}
{
import cache
auto_https disable_redirects
http_port 80
https_port 443
servers :80 {
protocols h1 h2 h3
}
}
:80 {
import headers
cache
respond "Hello world"
}
So almost the configuration you said it works. And I get
ERROR http.handlers.cache Impossible to set value into Redis, dial tcp 127.0.0.1:6379: connect: connection refused
Another test with really minimal Nuts.
(souin) {
log_level debug
allowed_http_verbs GET POST PATCH
api {
souin
}
headers Content-Type Authorization
ttl 300s
key {
disable_body
disable_host
disable_method
}
timeout {
backend 60s
cache 300ms
}
nuts
default_cache_control no-store
}
(cache) {
order cache before rewrite
cache {
import souin
}
}
# Global headers
(headersGlobal) {
X-Powered-By "Zogg"
}
# Security headers
(headersSecurity) {
# Keep referrer data off of HTTP connections
Referrer-Policy "strict-origin-when-cross-origin"
# Enable HSTS
Strict-Transport-Security "max-age=63072000, includeSubDomains, preload"
X-Permitted-Cross-Domain-Policies: "none"
# Disable clients from sniffing the media type
X-Content-Type-Options "nosniff"
# Clickjacking protection
X-Frame-Options "SAMEORIGIN"
# Disable XSS protection
X-XSS-Protection 0
# Permissions
Permissions-Policy "vibrate=(self), geolocation=(self), midi=(self), notifications=(self), push=(self), microphone=(self), camera=(self), magnetometer=(self), gyroscope=(self), fullscreen=(self), payment=(self)"
# CSP
Content-Security-Policy "default-src 'self' *.zogg.fr data: wss: blob: https:; script-src 'self' 'unsafe-eval' 'unsafe-inline' *.zogg.fr data: blob: https:; img-src 'self' data: blob: *.zogg.Fr https:;style-src 'self' 'unsafe-inline' *.zogg.fr https:; connect-src 'self' wss: *.zogg.fr https:; frame-src 'self' https:; frame-ancestors 'self' *.zogg.fr"
}
(headersRobots) {
# Robots
X-Robots-Tag "none,noarchive,nosnippet,notranslate,noimageindex"
}
(headersCaching) {
# Caching
Cache-Control "public, max-age=86400, s-maxage=86400, max-stale=3600, stale-while-revalidate=86400, stale-if-error=86400"
header_up Cache-Control "public, max-age=86400, s-maxage=86400, max-stale=3600, stale-while-revalidate=86400, stale-if-error=86400"
}
(headers) {
header {
import headersGlobal
import headersRobots
import headersCaching
import headersSecurity
}
}
{
import cache
auto_https disable_redirects
debug
log {
level debug
}
http_port 80
https_port 443
servers :80 {
protocols h1 h2 h3
}
}
localhost:80 {
import headers
cache
respond "Hello world"
}
Caddy's log:
05/12/2022 9:00:17
2022/12/05 08:00:17.756 INFO using provided configuration {"config_file": "/etc/caddy/Caddyfile", "config_adapter": "caddyfile"}
05/12/2022 9:00:17
2022/12/05 08:00:17.757 WARN Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies {"adapter": "caddyfile", "file": "/etc/caddy/Caddyfile", "line": 24}
05/12/2022 9:00:17
2022/12/05 08:00:17.758 INFO admin admin endpoint started {"address": "localhost:2019", "enforce_origin": false, "origins": ["//localhost:2019", "//[::1]:2019", "//127.0.0.1:2019"]}
05/12/2022 9:00:17
2022/12/05 08:00:17.758 WARN http server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server {"server_name": "srv0", "http_port": 80}
05/12/2022 9:00:17
2022/12/05 08:00:17.758 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc00044a540"}
05/12/2022 9:00:17
2022/12/05 08:00:17.760 INFO http.handlers.cache Set nextTxnTs to 0
05/12/2022 9:00:17
2022/12/05 08:00:17.760 DEBUG http.handlers.cache Provider initialized.
05/12/2022 9:00:17
2022/12/05 08:00:17.760 DEBUG http.handlers.cache Transport initialized.
05/12/2022 9:00:17
2022/12/05 08:00:17.760 DEBUG http.handlers.cache Set Souin as Cache-Status name
05/12/2022 9:00:17
2022/12/05 08:00:17.760 DEBUG http.handlers.cache Enable GraphQL logic due to your custom HTTP verbs setup.
05/12/2022 9:00:17
2022/12/05 08:00:17.760 DEBUG http.handlers.cache Allow 3 method(s). [GET POST PATCH].
05/12/2022 9:00:17
2022/12/05 08:00:17.760 INFO http.handlers.cache Set backend timeout to 1m0s
05/12/2022 9:00:17
2022/12/05 08:00:17.760 INFO http.handlers.cache Set cache timeout to 1m0s
05/12/2022 9:00:17
2022/12/05 08:00:17.760 INFO http.handlers.cache Souin configuration is now loaded.
05/12/2022 9:00:17
2022/12/05 08:00:17.761 DEBUG http starting server loop {"address": "[::]:80", "tls": false, "http3": false}
05/12/2022 9:00:17
2022/12/05 08:00:17.761 INFO http.log server running {"name": "srv0", "protocols": ["h1", "h2", "h3"]}
05/12/2022 9:00:17
2022/12/05 08:00:17.761 INFO tls cleaning storage unit {"description": "FileStorage:/data/caddy"}
05/12/2022 9:00:17
2022/12/05 08:00:17.761 INFO tls finished cleaning storage units
05/12/2022 9:00:17
2022/12/05 08:00:17.761 INFO autosaved config (load with --resume flag) {"file": "/config/caddy/autosave.json"}
05/12/2022 9:00:17
2022/12/05 08:00:17.761 INFO serving initial configuration
05/12/2022 9:00:19
2022/12/05 08:00:19.813 DEBUG http.handlers.cache Incoming request: &{Method:GET URL:/ Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Accept:[text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9] Accept-Encoding:[gzip, deflate, br] Accept-Language:[fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7] Cache-Control:[max-age=0] Connection:[keep-alive] Date:[Mon, 05 Dec 2022 08:00:19 UTC] Dnt:[1] Sec-Ch-Ua:["Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"] Sec-Ch-Ua-Mobile:[?0] Sec-Ch-Ua-Platform:["Linux"] Sec-Fetch-Dest:[document] Sec-Fetch-Mode:[navigate] Sec-Fetch-Site:[none] Sec-Fetch-User:[?1] Upgrade-Insecure-Requests:[1] User-Agent:[Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36]] Body:{} GetBody:<nil> ContentLength:0 TransferEncoding:[] Close:false Host:localhost Form:map[] PostForm:map[] MultipartForm:<nil> Trailer:map[] RemoteAddr:10.151.6.1:56992 RequestURI:/ TLS:<nil> Cancel:<nil> Response:<nil> ctx:0xc00026f830}
05/12/2022 9:00:19
2022/12/05 08:00:19.813 DEBUG http.handlers.cache writeRequests called. Writing to value log
05/12/2022 9:00:19
2022/12/05 08:00:19.813 DEBUG http.handlers.cache Sending updates to subscribers
05/12/2022 9:00:19
2022/12/05 08:00:19.813 DEBUG http.handlers.cache Writing to memtable
05/12/2022 9:00:19
2022/12/05 08:00:19.813 DEBUG http.handlers.cache 2 entries written
05/12/2022 9:00:19
2022/12/05 08:00:19.813 DEBUG http.handlers.cache writeRequests called. Writing to value log
05/12/2022 9:00:19
2022/12/05 08:00:19.813 DEBUG http.handlers.cache Sending updates to subscribers
05/12/2022 9:00:19
2022/12/05 08:00:19.813 DEBUG http.handlers.cache Writing to memtable
05/12/2022 9:00:19
2022/12/05 08:00:19.813 DEBUG http.handlers.cache 2 entries written
Browser console:
Cache-Status: Souin; fwd=uri-miss; stored
Something is store but I think Souin as a problem with URI handling.
Same if I replace nuts with badger or redis.
uri-miss: The cache did not contain any responses that matched the request URI.
In your request headers you have
Request Headers
[...]
cache-control: max-age=0
[...]
That's why it doesn't serve the response from the cache. But that doesn't explain why it doesn't store in the backend.
@kraoc sorry I forgot I also use the header handler modifier on my config to remove cache-control
from the client. I personally dont understand why the server would ever let the client control any of the caching so I remove it completely. I need the server and my upstream apps to be in control of the caching not the clients:
"handle": [
{
"handler": "headers",
"request": {
"delete": [
"cache-control",
"pragma"
]
}
Well honestlly, I just own an homelab with 79 containers / 49 stacks...
Running from simple to complex stacks (Dozzle to cAdviser+NodeExporter+Prometheus+InfluxDB+Telegraf+Grafana) to a little more complex stacks (Pterodactyl inside Docker... aka Inception lol) and have not such difficulties to run these else than souin.
I setup a basic Traefik+Vanish in 4 hours, and got caching.
With Souin I never get a cache HIT.
I give up and will update my Caddy stack to use Varnish this week.
Thanks for your time anyway :)
Regards
Your choice 🤷♂️
I made a post at Caddy forum since I thought it was a Caddy related problem (or misconfiguration on my way).
But I realize that it can also be wrong on Souin size...
I'm new to Caddy and I tried Souin with Traefik but... 'latest' as a plugin simply crash... So I tried to switch to Caddy (seems better performances) with Souin :p
What I use: Docker / Caddy + Souin built docker image
The post with the files: https://caddy.community/t/caddy-caching-souin/17934
docker-compose.yml
Caddyfile
entries
No way to get anything than:
So what's wrong with my conf ?