Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion render.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -1372,14 +1372,23 @@ in.}
=> header-value]
[else
#"Unknown"]))
;; Requests proxied through Cloudflare arrive from an edge address, so
;; `request-client-ip` reports the edge instead of the original client.
(define client-ip
(cond
[(headers-assq* #"CF-Connecting-IP"
(request-headers/raw req))
=> (lambda (h) (bytes->string/utf-8 (header-value h) #\?))]
[else
(request-client-ip req)]))
(cond
[(regexp-match #"Googlebot" user-agent)
(response/xexpr "Please, do not index.")]
[else
(printf "~a - ~a ~a\n"
(url->string (request-uri req))
user-agent
(request-client-ip req))
client-ip)
(parameterize ([drdr-start-request (current-inexact-milliseconds)])
(top-dispatch req))]))

Expand Down
Loading