Skip to content

Commit 47a7ccf

Browse files
Modify VCL for use of Cloudflare + Blackfire
Update VCL to restore client IP from Cloudflare and adjust Blackfire query handling.
1 parent 2b1cd1f commit 47a7ccf

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

docs/best-practices/performance/how-to-use-blackfire-on-hypernode-to-find-performance-issues.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ acl profile {
6868
}
6969
7070
sub vcl_recv {
71+
# Restore client IP from Cloudflare
72+
if (req.http.CF-Connecting-IP) {
73+
set req.http.X-Real-IP = req.http.CF-Connecting-IP;
74+
} else {
75+
set req.http.X-Real-IP = client.ip;
76+
}
77+
7178
if (req.esi_level > 0) {
7279
# ESI request should not be included in the profile.
7380
# Instead you should profile them separately, each one
@@ -80,7 +87,7 @@ sub vcl_recv {
8087
8188
# If it's a Blackfire query and the client is authorized,
8289
# just pass directly to the application.
83-
if (req.http.X-Blackfire-Query && client.ip ~ profile) {
90+
if (req.http.X-Blackfire-Query && std.ip(req.http.X-Real-IP, "0.0.0.0") ~ profile) {
8491
return (pass);
8592
}
8693
}

0 commit comments

Comments
 (0)