1. The problem I’m having:
When making requests using my Flutter app I often get TLS errors. The issues show up in mobile app and Linux app but not in the web browser app.
The weird part is that it does not always have issues. If I constantly spam the curl command or reopen the apps sometimes the contents shows up there and it has no TLS issues.
Another strange thing. If I build release APK and install it on the phone and it doesnt work. If I launch it using debug tools everything works smoothly.
What I’ve tried so far:
- Changing the max TLS protocol to 1.2 which seemed to improve things a bit but still not perfect.
- Using native HTTP clients in the implementations. Not much improvement.
Another thing I discovered. If I do curl localhost:2019/config/
, sometimes its responding with configuration for one subdomain and sometimes its responding with the config of the other.
flutter: HTTP get request to https://api.focus-stones.pl/api/warehouses/public/ error: HandshakeException: Handshake error in client (OS Error:
TLSV1_ALERT_INTERNAL_ERROR(tls_record.cc:583))
flutter: Error fetching warehouses: HandshakeException: Handshake error in client (OS Error:
TLSV1_ALERT_INTERNAL_ERROR(tls_record.cc:583))
❯ curl -vL https://api.focus-stones.pl:443
* Host api.focus-stones.pl:443 was resolved.
* IPv6: (none)
* IPv4: 13.74.160.33
* Trying 13.74.160.33:443...
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: none
* TLSv1.3 (IN), TLS alert, internal error (592):
* TLS connect error: error:0A000438:SSL routines::tlsv1 alert internal error
* closing connection #0
curl: (35) TLS connect error: error:0A000438:SSL routines::tlsv1 alert internal error
2. Error messages and/or full log output:
{"level":"info","ts":1743595271.6769328,"msg":"using config from file","file":"Caddyfile"}
{"level":"info","ts":1743595271.6778836,"msg":"adapted config to JSON","adapter":"caddyfile"}
{"level":"info","ts":1743595271.6784341,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"info","ts":1743595271.678545,"logger":"http.auto_https","msg":"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}
{"level":"info","ts":1743595271.678554,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
{"level":"info","ts":1743595271.6786191,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000133100"}
{"level":"debug","ts":1743595271.6785698,"logger":"http.auto_https","msg":"adjusted config","tls":{"automation":{"policies":[{}]}},"http":{"servers":{"remaining_auto_https_redirects":{"listen":[":80"],"routes":[{},{}]},"srv0":{"listen":[":443"],"routes":[{"handle":[{"handler":"subroute","routes":[{"handle":[{"encodings":{"gzip":{},"zstd":{}},"handler":"encode","prefer":["zstd","gzip"]}]},{"group":"group2","handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"rewrite","strip_path_prefix":"/static"}]},{"handle":[{"handler":"vars","root":"./static"},{"handler":"file_server","hide":["./Caddyfile"]}]}]}],"match":[{"path":["/static/*"]}]},{"group":"group2","handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"localhost:8000"}]}]}]}]}]}],"terminal":true}],"tls_connection_policies":[{}],"automatic_https":{}}}}}
{"level":"debug","ts":1743595271.679198,"logger":"http","msg":"starting server loop","address":"[::]:443","tls":true,"http3":false}
{"level":"info","ts":1743595271.679214,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
{"level":"info","ts":1743595271.6793256,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"debug","ts":1743595271.6793613,"logger":"http","msg":"starting server loop","address":"[::]:80","tls":false,"http3":false}
{"level":"warn","ts":1743595271.6793659,"logger":"http","msg":"HTTP/2 skipped because it requires TLS","network":"tcp","addr":":80"}
{"level":"warn","ts":1743595271.6793683,"logger":"http","msg":"HTTP/3 skipped because it requires TLS","network":"tcp","addr":":80"}
{"level":"info","ts":1743595271.6793702,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
{"level":"info","ts":1743595271.6793728,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["api.focus-stones.pl"]}
{"level":"debug","ts":1743595271.679701,"logger":"tls.cache","msg":"added certificate to cache","subjects":["api.focus-stones.pl"],"expiration":1751296749,"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"e453a75c8825e33653ebafa2cbac458553192a5fe756b16c082e80b188761590","cache_size":1,"cache_capacity":10000}
{"level":"debug","ts":1743595271.6797192,"logger":"events","msg":"event","name":"cached_managed_cert","id":"374f9d48-3a96-4f59-9fbc-86fa54d56eb8","origin":"tls","data":{"sans":["api.focus-stones.pl"]}}
{"level":"info","ts":1743595271.679802,"msg":"autosaved config (load with --resume flag)","file":"/root/.config/caddy/autosave.json"}
{"level":"info","ts":1743595271.6798065,"msg":"serving initial configuration"}
{"level":"info","ts":1743595271.6828234,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/root/.local/share/caddy","instance":"37646e83-f034-4e13-b4c1-5a3e20eae4da","try_again":1743681671.6828222,"try_again_in":86399.99999971}
{"level":"info","ts":1743595271.682876,"logger":"tls","msg":"finished cleaning storage units"}
{"level":"debug","ts":1743595304.260434,"logger":"events","msg":"event","name":"tls_get_certificate","id":"216b2fac-8bc4-465c-a2ca-a160f2de7c9a","origin":"tls","data":{"client_hello":{"CipherSuites":[4865,4867,4866,49195,49199,52393,52392,49196,49200,49162,49161,49171,49172,156,157,47,53],"ServerName":"api.focus-stones.pl","SupportedCurves":[4588,29,23,24,25,256,257],"SupportedPoints":"AA==","SignatureSchemes":[1027,1283,1539,2052,2053,2054,1025,1281,1537,515,513],"SupportedProtos":["h2","http/1.1"],"SupportedVersions":[772,771],"RemoteAddr":{"IP":"185.166.171.140","Port":34944,"Zone":""},"LocalAddr":{"IP":"10.1.1.4","Port":443,"Zone":""}}}}
{"level":"debug","ts":1743595304.2605603,"logger":"tls.handshake","msg":"choosing certificate","identifier":"api.focus-stones.pl","num_choices":1}
{"level":"debug","ts":1743595304.2605648,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"api.focus-stones.pl","subjects":["api.focus-stones.pl"],"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"e453a75c8825e33653ebafa2cbac458553192a5fe756b16c082e80b188761590"}
{"level":"debug","ts":1743595304.2605696,"logger":"tls.handshake","msg":"matched certificate in cache","remote_ip":"185.166.171.140","remote_port":"34944","subjects":["api.focus-stones.pl"],"managed":true,"expiration":1751296749,"hash":"e453a75c8825e33653ebafa2cbac458553192a5fe756b16c082e80b188761590"}
{"level":"debug","ts":1743595304.300335,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"localhost:8000","total_upstreams":1}
{"level":"debug","ts":1743595304.3004372,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"localhost:8000","total_upstreams":1}
{"level":"debug","ts":1743595304.3006358,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"localhost:8000","total_upstreams":1}
{"level":"debug","ts":1743595304.306259,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"localhost:8000","duration":0.005876009,"request":{"remote_ip":"185.166.171.140","remote_port":"34944","client_ip":"185.166.171.140","proto":"HTTP/2.0","method":"GET","host":"api.focus-stones.pl","uri":"/api/inventory/public/","headers":{"Priority":["u=4"],"Content-Type":["application/json"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0"],"X-Forwarded-For":["185.166.171.140"],"Accept-Language":["en-US,en;q=0.5"],"Sec-Gpc":["1"],"X-Forwarded-Proto":["https"],"X-Forwarded-Host":["api.focus-stones.pl"],"Sec-Fetch-Site":["same-site"],"Te":["trailers"],"Origin":["https://app.focus-stones.pl"],"Dnt":["1"],"Sec-Fetch-Dest":["empty"],"Accept":["*/*"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Referer":["https://app.focus-stones.pl/"],"Sec-Fetch-Mode":["cors"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.focus-stones.pl"}},"headers":{"Content-Type":["application/json"],"Content-Length":["155"],"Referrer-Policy":["same-origin"],"Date":["Wed, 02 Apr 2025 12:01:44 GMT"],"Vary":["Accept, origin"],"Allow":["GET, HEAD, OPTIONS"],"X-Frame-Options":["DENY"],"Access-Control-Allow-Origin":["https://app.focus-stones.pl"],"Strict-Transport-Security":["max-age=60; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"Server":["gunicorn"],"Cross-Origin-Opener-Policy":["same-origin"]},"status":200}
{"level":"debug","ts":1743595304.3080328,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"localhost:8000","duration":0.007565851,"request":{"remote_ip":"185.166.171.140","remote_port":"34944","client_ip":"185.166.171.140","proto":"HTTP/2.0","method":"GET","host":"api.focus-stones.pl","uri":"/api/warehouses/public/","headers":{"Sec-Fetch-Mode":["cors"],"X-Forwarded-Proto":["https"],"Sec-Fetch-Dest":["empty"],"Accept":["*/*"],"Accept-Language":["en-US,en;q=0.5"],"Priority":["u=4"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0"],"Origin":["https://app.focus-stones.pl"],"X-Forwarded-Host":["api.focus-stones.pl"],"Content-Type":["application/json"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Te":["trailers"],"Referer":["https://app.focus-stones.pl/"],"Sec-Fetch-Site":["same-site"],"X-Forwarded-For":["185.166.171.140"],"Sec-Gpc":["1"],"Dnt":["1"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.focus-stones.pl"}},"headers":{"Strict-Transport-Security":["max-age=60; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"Referrer-Policy":["same-origin"],"Content-Type":["application/json"],"Vary":["Accept, origin"],"Allow":["GET, HEAD, OPTIONS"],"Access-Control-Allow-Origin":["https://app.focus-stones.pl"],"Content-Length":["105"],"Cross-Origin-Opener-Policy":["same-origin"],"Server":["gunicorn"],"Date":["Wed, 02 Apr 2025 12:01:44 GMT"],"X-Frame-Options":["DENY"]},"status":200}
{"level":"debug","ts":1743595304.3102028,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"localhost:8000","duration":0.009532198,"request":{"remote_ip":"185.166.171.140","remote_port":"34944","client_ip":"185.166.171.140","proto":"HTTP/2.0","method":"GET","host":"api.focus-stones.pl","uri":"/api/products/public/","headers":{"Sec-Fetch-Dest":["empty"],"Accept-Language":["en-US,en;q=0.5"],"X-Forwarded-For":["185.166.171.140"],"X-Forwarded-Proto":["https"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Content-Type":["application/json"],"Sec-Fetch-Mode":["cors"],"Sec-Gpc":["1"],"X-Forwarded-Host":["api.focus-stones.pl"],"Accept":["*/*"],"Dnt":["1"],"Referer":["https://app.focus-stones.pl/"],"Te":["trailers"],"Sec-Fetch-Site":["same-site"],"Priority":["u=4"],"Origin":["https://app.focus-stones.pl"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.focus-stones.pl"}},"headers":{"Server":["gunicorn"],"Date":["Wed, 02 Apr 2025 12:01:44 GMT"],"Vary":["Accept, origin"],"Allow":["GET, HEAD, OPTIONS"],"Content-Length":["721"],"Cross-Origin-Opener-Policy":["same-origin"],"Content-Type":["application/json"],"X-Frame-Options":["DENY"],"Access-Control-Allow-Origin":["https://app.focus-stones.pl"],"Strict-Transport-Security":["max-age=60; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"Referrer-Policy":["same-origin"]},"status":200}
{"level":"debug","ts":1743595306.3511317,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"localhost:8000","total_upstreams":1}
{"level":"debug","ts":1743595306.351191,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"localhost:8000","total_upstreams":1}
{"level":"debug","ts":1743595306.351375,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"localhost:8000","total_upstreams":1}
{"level":"debug","ts":1743595306.3542452,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"localhost:8000","duration":0.003025068,"request":{"remote_ip":"185.166.171.140","remote_port":"34944","client_ip":"185.166.171.140","proto":"HTTP/2.0","method":"GET","host":"api.focus-stones.pl","uri":"/api/products/public/","headers":{"Sec-Fetch-Dest":["empty"],"Referer":["https://app.focus-stones.pl/"],"Content-Type":["application/json"],"Dnt":["1"],"Sec-Gpc":["1"],"Sec-Fetch-Site":["same-site"],"Priority":["u=4"],"X-Forwarded-Proto":["https"],"Accept":["*/*"],"Origin":["https://app.focus-stones.pl"],"X-Forwarded-For":["185.166.171.140"],"Accept-Language":["en-US,en;q=0.5"],"Sec-Fetch-Mode":["cors"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0"],"Te":["trailers"],"X-Forwarded-Host":["api.focus-stones.pl"],"Accept-Encoding":["gzip, deflate, br, zstd"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.focus-stones.pl"}},"headers":{"Content-Type":["application/json"],"X-Frame-Options":["DENY"],"Access-Control-Allow-Origin":["https://app.focus-stones.pl"],"Cross-Origin-Opener-Policy":["same-origin"],"Server":["gunicorn"],"Vary":["Accept, origin"],"Allow":["GET, HEAD, OPTIONS"],"Content-Length":["721"],"Strict-Transport-Security":["max-age=60; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"Referrer-Policy":["same-origin"],"Date":["Wed, 02 Apr 2025 12:01:46 GMT"]},"status":200}
{"level":"debug","ts":1743595306.358146,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"localhost:8000","duration":0.006965085,"request":{"remote_ip":"185.166.171.140","remote_port":"34944","client_ip":"185.166.171.140","proto":"HTTP/2.0","method":"GET","host":"api.focus-stones.pl","uri":"/api/warehouses/public/","headers":{"Origin":["https://app.focus-stones.pl"],"Accept":["*/*"],"X-Forwarded-Proto":["https"],"X-Forwarded-Host":["api.focus-stones.pl"],"Sec-Gpc":["1"],"Sec-Fetch-Mode":["cors"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0"],"Referer":["https://app.focus-stones.pl/"],"Accept-Language":["en-US,en;q=0.5"],"X-Forwarded-For":["185.166.171.140"],"Content-Type":["application/json"],"Sec-Fetch-Site":["same-site"],"Dnt":["1"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Priority":["u=4"],"Sec-Fetch-Dest":["empty"],"Te":["trailers"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.focus-stones.pl"}},"headers":{"Content-Length":["105"],"Access-Control-Allow-Origin":["https://app.focus-stones.pl"],"Cross-Origin-Opener-Policy":["same-origin"],"Date":["Wed, 02 Apr 2025 12:01:46 GMT"],"Content-Type":["application/json"],"Vary":["Accept, origin"],"Allow":["GET, HEAD, OPTIONS"],"Server":["gunicorn"],"X-Frame-Options":["DENY"],"Strict-Transport-Security":["max-age=60; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"Referrer-Policy":["same-origin"]},"status":200}
{"level":"debug","ts":1743595306.3598418,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"localhost:8000","duration":0.00843442,"request":{"remote_ip":"185.166.171.140","remote_port":"34944","client_ip":"185.166.171.140","proto":"HTTP/2.0","method":"GET","host":"api.focus-stones.pl","uri":"/api/inventory/public/","headers":{"Accept":["*/*"],"Accept-Language":["en-US,en;q=0.5"],"Origin":["https://app.focus-stones.pl"],"Dnt":["1"],"Sec-Fetch-Site":["same-site"],"Sec-Fetch-Dest":["empty"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Sec-Gpc":["1"],"X-Forwarded-Proto":["https"],"Priority":["u=4"],"Te":["trailers"],"Content-Type":["application/json"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0"],"Sec-Fetch-Mode":["cors"],"X-Forwarded-Host":["api.focus-stones.pl"],"Referer":["https://app.focus-stones.pl/"],"X-Forwarded-For":["185.166.171.140"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.focus-stones.pl"}},"headers":{"Allow":["GET, HEAD, OPTIONS"],"X-Frame-Options":["DENY"],"Content-Length":["155"],"Strict-Transport-Security":["max-age=60; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"Referrer-Policy":["same-origin"],"Server":["gunicorn"],"Vary":["Accept, origin"],"Access-Control-Allow-Origin":["https://app.focus-stones.pl"],"Cross-Origin-Opener-Policy":["same-origin"],"Date":["Wed, 02 Apr 2025 12:01:46 GMT"],"Content-Type":["application/json"]},"status":200}
{"level":"debug","ts":1743595306.4850173,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"localhost:8000","total_upstreams":1}
{"level":"debug","ts":1743595306.6755455,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"localhost:8000","duration":0.190479434,"request":{"remote_ip":"185.166.171.140","remote_port":"34944","client_ip":"185.166.171.140","proto":"HTTP/2.0","method":"GET","host":"api.focus-stones.pl","uri":"/api/proxy/image/?url=https%3A%2F%2Ffocus-stones.pl%2Fimages%2Fmaterialy%2Fpodswietlane%2Fonyx%2FBLUE%2Fniebieski_onyx1.jpg","headers":{"Accept-Language":["en-US,en;q=0.5"],"Referer":["https://app.focus-stones.pl/"],"Dnt":["1"],"X-Forwarded-For":["185.166.171.140"],"X-Forwarded-Host":["api.focus-stones.pl"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0"],"Priority":["u=5, i"],"Origin":["https://app.focus-stones.pl"],"X-Forwarded-Proto":["https"],"Sec-Gpc":["1"],"Te":["trailers"],"Accept":["image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"],"Sec-Fetch-Site":["same-site"],"Sec-Fetch-Mode":["cors"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Sec-Fetch-Dest":["image"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.focus-stones.pl"}},"headers":{"Server":["gunicorn"],"Cache-Control":["max-age=86400, public"],"X-Frame-Options":["DENY"],"Content-Length":["51883"],"Access-Control-Allow-Origin":["https://app.focus-stones.pl"],"X-Content-Type-Options":["nosniff"],"Cross-Origin-Opener-Policy":["same-origin"],"Date":["Wed, 02 Apr 2025 12:01:46 GMT"],"Content-Type":["image/jpeg"],"Vary":["origin"],"Strict-Transport-Security":["max-age=60; includeSubDomains; preload"],"Referrer-Policy":["same-origin"]},"status":200}
{"level":"debug","ts":1743595310.9069507,"logger":"events","msg":"event","name":"tls_get_certificate","id":"cc30e398-3877-4b0f-8b68-2109bf7a58be","origin":"tls","data":{"client_hello":{"CipherSuites":[4866,4867,4865,49196,49200,159,52393,52392,52394,49195,49199,158,49188,49192,107,49187,49191,103,49162,49172,57,49161,49171,51,157,156,61,60,53,47],"ServerName":"api.focus-stones.pl","SupportedCurves":[29,23,30,25,24,256,257,258,259,260],"SupportedPoints":"AAEC","SignatureSchemes":[1027,1283,1539,2055,2056,2074,2075,2076,2057,2058,2059,2052,2053,2054,1025,1281,1537,771,769,770,1026,1282,1538],"SupportedProtos":["h2","http/1.1"],"SupportedVersions":[772,771],"RemoteAddr":{"IP":"185.166.171.140","Port":34952,"Zone":""},"LocalAddr":{"IP":"10.1.1.4","Port":443,"Zone":""}}}}
{"level":"debug","ts":1743595310.9070215,"logger":"tls.handshake","msg":"choosing certificate","identifier":"api.focus-stones.pl","num_choices":1}
{"level":"debug","ts":1743595310.9070277,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"api.focus-stones.pl","subjects":["api.focus-stones.pl"],"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"e453a75c8825e33653ebafa2cbac458553192a5fe756b16c082e80b188761590"}
{"level":"debug","ts":1743595310.9070334,"logger":"tls.handshake","msg":"matched certificate in cache","remote_ip":"185.166.171.140","remote_port":"34952","subjects":["api.focus-stones.pl"],"managed":true,"expiration":1751296749,"hash":"e453a75c8825e33653ebafa2cbac458553192a5fe756b16c082e80b188761590"}
{"level":"debug","ts":1743595310.9472682,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"localhost:8000","total_upstreams":1}
{"level":"debug","ts":1743595310.948373,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"localhost:8000","duration":0.001076835,"request":{"remote_ip":"185.166.171.140","remote_port":"34952","client_ip":"185.166.171.140","proto":"HTTP/2.0","method":"GET","host":"api.focus-stones.pl","uri":"/","headers":{"X-Forwarded-Proto":["https"],"X-Forwarded-Host":["api.focus-stones.pl"],"User-Agent":["curl/8.12.1"],"Accept":["*/*"],"X-Forwarded-For":["185.166.171.140"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.focus-stones.pl"}},"headers":{"Server":["gunicorn"],"Date":["Wed, 02 Apr 2025 12:01:50 GMT"],"Strict-Transport-Security":["max-age=60; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"Referrer-Policy":["same-origin"],"Cross-Origin-Opener-Policy":["same-origin"],"Content-Type":["text/html; charset=utf-8"],"X-Frame-Options":["DENY"],"Content-Length":["179"],"Vary":["origin"]},"status":404}
{"level":"debug","ts":1743595311.9141037,"logger":"events","msg":"event","name":"tls_get_certificate","id":"f296b95b-4047-4c1d-bc14-72d790a11973","origin":"tls","data":{"client_hello":{"CipherSuites":[4866,4867,4865,49196,49200,159,52393,52392,52394,49195,49199,158,49188,49192,107,49187,49191,103,49162,49172,57,49161,49171,51,157,156,61,60,53,47],"ServerName":"api.focus-stones.pl","SupportedCurves":[29,23,30,25,24,256,257,258,259,260],"SupportedPoints":"AAEC","SignatureSchemes":[1027,1283,1539,2055,2056,2074,2075,2076,2057,2058,2059,2052,2053,2054,1025,1281,1537,771,769,770,1026,1282,1538],"SupportedProtos":["h2","http/1.1"],"SupportedVersions":[772,771],"RemoteAddr":{"IP":"185.166.171.140","Port":34956,"Zone":""},"LocalAddr":{"IP":"10.1.1.4","Port":443,"Zone":""}}}}
{"level":"debug","ts":1743595311.9141626,"logger":"tls.handshake","msg":"choosing certificate","identifier":"api.focus-stones.pl","num_choices":1}
{"level":"debug","ts":1743595311.9141665,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"api.focus-stones.pl","subjects":["api.focus-stones.pl"],"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"e453a75c8825e33653ebafa2cbac458553192a5fe756b16c082e80b188761590"}
{"level":"debug","ts":1743595311.9141703,"logger":"tls.handshake","msg":"matched certificate in cache","remote_ip":"185.166.171.140","remote_port":"34956","subjects":["api.focus-stones.pl"],"managed":true,"expiration":1751296749,"hash":"e453a75c8825e33653ebafa2cbac458553192a5fe756b16c082e80b188761590"}
{"level":"debug","ts":1743595311.9568694,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"localhost:8000","total_upstreams":1}
{"level":"debug","ts":1743595311.9580452,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"localhost:8000","duration":0.001141396,"request":{"remote_ip":"185.166.171.140","remote_port":"34956","client_ip":"185.166.171.140","proto":"HTTP/2.0","method":"GET","host":"api.focus-stones.pl","uri":"/","headers":{"User-Agent":["curl/8.12.1"],"Accept":["*/*"],"X-Forwarded-For":["185.166.171.140"],"X-Forwarded-Proto":["https"],"X-Forwarded-Host":["api.focus-stones.pl"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.focus-stones.pl"}},"headers":{"X-Frame-Options":["DENY"],"Content-Length":["179"],"Vary":["origin"],"X-Content-Type-Options":["nosniff"],"Referrer-Policy":["same-origin"],"Server":["gunicorn"],"Content-Type":["text/html; charset=utf-8"],"Strict-Transport-Security":["max-age=60; includeSubDomains; preload"],"Cross-Origin-Opener-Policy":["same-origin"],"Date":["Wed, 02 Apr 2025 12:01:51 GMT"]},"status":404}
{"level":"debug","ts":1743595312.6678066,"logger":"events","msg":"event","name":"tls_get_certificate","id":"95854956-37ae-46f1-a962-ae99a502b0af","origin":"tls","data":{"client_hello":{"CipherSuites":[4866,4867,4865,49196,49200,159,52393,52392,52394,49195,49199,158,49188,49192,107,49187,49191,103,49162,49172,57,49161,49171,51,157,156,61,60,53,47],"ServerName":"api.focus-stones.pl","SupportedCurves":[29,23,30,25,24,256,257,258,259,260],"SupportedPoints":"AAEC","SignatureSchemes":[1027,1283,1539,2055,2056,2074,2075,2076,2057,2058,2059,2052,2053,2054,1025,1281,1537,771,769,770,1026,1282,1538],"SupportedProtos":["h2","http/1.1"],"SupportedVersions":[772,771],"RemoteAddr":{"IP":"185.166.171.140","Port":34964,"Zone":""},"LocalAddr":{"IP":"10.1.1.4","Port":443,"Zone":""}}}}
{"level":"debug","ts":1743595312.6678545,"logger":"tls.handshake","msg":"choosing certificate","identifier":"api.focus-stones.pl","num_choices":1}
{"level":"debug","ts":1743595312.6678588,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"api.focus-stones.pl","subjects":["api.focus-stones.pl"],"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"e453a75c8825e33653ebafa2cbac458553192a5fe756b16c082e80b188761590"}
{"level":"debug","ts":1743595312.6678636,"logger":"tls.handshake","msg":"matched certificate in cache","remote_ip":"185.166.171.140","remote_port":"34964","subjects":["api.focus-stones.pl"],"managed":true,"expiration":1751296749,"hash":"e453a75c8825e33653ebafa2cbac458553192a5fe756b16c082e80b188761590"}
{"level":"debug","ts":1743595312.7079856,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"localhost:8000","total_upstreams":1}
{"level":"debug","ts":1743595312.708965,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"localhost:8000","duration":0.000950758,"request":{"remote_ip":"185.166.171.140","remote_port":"34964","client_ip":"185.166.171.140","proto":"HTTP/2.0","method":"GET","host":"api.focus-stones.pl","uri":"/","headers":{"X-Forwarded-For":["185.166.171.140"],"X-Forwarded-Proto":["https"],"X-Forwarded-Host":["api.focus-stones.pl"],"User-Agent":["curl/8.12.1"],"Accept":["*/*"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.focus-stones.pl"}},"headers":{"Referrer-Policy":["same-origin"],"X-Frame-Options":["DENY"],"Content-Type":["text/html; charset=utf-8"],"Content-Length":["179"],"Vary":["origin"],"Strict-Transport-Security":["max-age=60; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"Cross-Origin-Opener-Policy":["same-origin"],"Server":["gunicorn"],"Date":["Wed, 02 Apr 2025 12:01:52 GMT"]},"status":404}
3. Caddy version:
v2.9.1 h1:OEYiZ7DbCzAWVb6TNEkjRcSCRGHVoZsJinoDR/n9oaY=
4. How I installed and ran Caddy:
Install:
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy
Run:
nohup ./caddy.sh &
Script:
#!/bin/bash
sudo caddy run --config Caddyfile
a. System environment:
VPS, Ubuntu
/etc/os-release:
PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
b. Command:
nohup ./caddy.sh &
c. Service/unit/compose file:
N/A
d. My complete Caddy config:
{
debug
}
api.focus-stones.pl {
encode
handle_path /static/* {
root * ./static
file_server
}
# Reverse proxy for all other requests
handle {
reverse_proxy http://localhost:8000
}
}
5. Links to relevant resources:
N/A