diff --git a/CHANGELOG.md b/CHANGELOG.md index fabe05c..a78db04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v1.6.0 - 2024-11-04 + +- The Cloudflare Tunnel `"cf-connecting-ip"` header is now used to get the + client IP address. + ## v1.5.0 - 2024-11-04 - "Enter" keypresses no longer submit the form, to avoid accidental submissions. diff --git a/gleam.toml b/gleam.toml index a4d3680..3910af8 100644 --- a/gleam.toml +++ b/gleam.toml @@ -1,5 +1,5 @@ name = "survey" -version = "1.5.0" +version = "1.6.0" licences = ["Apache-2.0"] # Fill out these fields if you intend to generate HTML documentation or publish diff --git a/src/survey/router.gleam b/src/survey/router.gleam index ab0f84f..a078927 100644 --- a/src/survey/router.gleam +++ b/src/survey/router.gleam @@ -57,7 +57,7 @@ pub fn handle_form_submission(req: Request) -> Response { |> storail.key(id) |> storail.write([ #("id", id), - #("ip", request.get_header(req, "x-forwarded-for") |> result.unwrap("")), + #("ip", request.get_header(req, "cf-connecting-ip") |> result.unwrap("")), #("inserted-at", datetime.now_utc() |> datetime.to_string), ..answers ])