Skip to content

Commit 523f11b

Browse files
committed
Fixed #61
1 parent 2951037 commit 523f11b

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

Helper/VclGenerator.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,6 @@ public function insertSubHooks ( $node ) {
9999
return $node;
100100
}
101101

102-
public function insertForwardedFor ( $node ) {
103-
if ( $node ["type"] == "sub" && $node ["identifier"] == "vcl_recv" ) {
104-
$value = " set req.http.X-Forwarded-For = req.http.CF-Connecting-IP;" . $node ["value"];
105-
$raw = "sub " . $node ["identifier"] . " {\n" . $value . "\n}";
106-
$node ["value"] = $value;
107-
$node ["raw"] = $raw;
108-
return $node;
109-
}
110-
return $node;
111-
}
112-
113102
public function insertDeliver ( $node ) {
114103
if ( $node ["type"] == "sub" && $node ["identifier"] == "vcl_deliver" ) {
115104
$prefixed = implode ( "\n", [
@@ -234,7 +223,6 @@ function generateDefault ( $vcl ) {
234223
throw new Error ("Failed to customize config, please contact JetRails.");
235224
}
236225
$root = $this->insertHeaderComment ( $root );
237-
$root = $this->parser->visit ( $root, [ $this, "insertForwardedFor" ] );
238226
$root = $this->parser->visit ( $root, [ $this, "versionEndpoint" ] );
239227
$root = $this->parser->visit ( $root, [ $this, "modifyRecv" ] );
240228
$root = $this->parser->visit ( $root, [ $this, "insertBackendResponse" ] );

default.custom.vcl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* >jetrails_
3-
*
3+
*
44
* This file should be included within the default VCL file. It exists to help
55
* customize the default VCL without having to modify the file itself. This way,
66
* the default VCL can be updated without having to port over any customizations
@@ -9,11 +9,11 @@
99
* hooking system. The available hooks can be found below in the form of
1010
* subroutines. Their names end in either '_start' or '_end', to find when these
1111
* subroutines are executed, refer to the default VCL file.
12-
*
12+
*
1313
* To keep things tidy, it is recommended that you include a description of the
1414
* issue that the given code snippet solves as well as any helpful references
1515
* that lead you to that solution.
16-
*
16+
*
1717
* Please Note: Native Varnish subroutines such as 'vcl_synth' can also be
1818
* defined here since they are not currently being used by Magento. These
1919
* subroutines will be used in the default VCL, but it is important to make sure

default.vcl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* looking to customize the config, please look into the 'default.custom.vcl'
66
* file which this config uses to implement it's hooking system.
77
*
8-
* Generated on Magento Community 2.4.2 with JetRails_Varnish@3.0.0
8+
* Generated on Magento Community 2.4.2 with JetRails_Varnish@3.0.1
99
*/
1010

1111
# VCL version 5.0 is not supported so it should be 4.0 even though actually used Varnish version is 6
@@ -38,9 +38,9 @@ acl purge {
3838
sub vcl_recv {
3939
call custom_recv_start;
4040
if (req.method == "GET" && client.ip ~ purge && req.url == "/jetrails/varnish-config/versions") {
41-
return (synth(200, "Magento 2.4.2 / Module 3.0.0"));
41+
return (synth(200, "Magento 2.4.2 / Module 3.0.1"));
4242
}
43-
set req.http.X-Forwarded-For = req.http.CF-Connecting-IP;
43+
4444
if (req.restarts > 0) {
4545
set req.hash_always_miss = true;
4646
}
@@ -153,7 +153,7 @@ sub vcl_hash {
153153
if (req.http.X-Forwarded-Proto) {
154154
hash_data(req.http.X-Forwarded-Proto);
155155
}
156-
156+
157157

158158
if (req.url ~ "/graphql") {
159159
call process_graphql_headers;

0 commit comments

Comments
 (0)