18
18
* @copyright Copyright (c) 2016 Fastly, Inc. (http://www.fastly.com)
19
19
* @license BSD, see LICENSE_FASTLY_CDN.txt
20
20
*/
21
+
21
22
namespace Fastly \Cdn \Block \GeoIp ;
22
23
23
24
use Fastly \Cdn \Model \Config ;
@@ -60,13 +61,14 @@ class GetAction extends AbstractBlock
60
61
* @param EncoderInterface $urlEncoder
61
62
*/
62
63
public function __construct (
63
- Config $ config ,
64
- Context $ context ,
65
- Response $ response ,
66
- Url $ url ,
64
+ Config $ config ,
65
+ Context $ context ,
66
+ Response $ response ,
67
+ Url $ url ,
67
68
EncoderInterface $ urlEncoder ,
68
- array $ data = []
69
- ) {
69
+ array $ data = []
70
+ )
71
+ {
70
72
$ this ->config = $ config ;
71
73
$ this ->response = $ response ;
72
74
$ this ->url = $ url ;
@@ -92,8 +94,8 @@ protected function _toHtml() // @codingStandardsIgnoreLine - required by parent
92
94
$ currentUrl = $ this ->url ->getCurrentUrl ();
93
95
$ baseUrl = $ this ->url ->getBaseUrl ();
94
96
$ webTypeUrl = $ this ->url ->getBaseUrl (['_type ' => Url::URL_TYPE_WEB ]);
95
-
96
- if (strpos ($ currentUrl , $ baseUrl ) !== false ) {
97
+
98
+ if (strpos ($ currentUrl , rtrim ( $ baseUrl, " / " ) ) !== false ) {
97
99
$ targetUrl = $ currentUrl ;
98
100
} else {
99
101
$ targetUrl = str_replace ($ webTypeUrl , $ baseUrl , $ currentUrl );
@@ -109,7 +111,7 @@ protected function _toHtml() // @codingStandardsIgnoreLine - required by parent
109
111
$ this ->response ->setHeader ("x-esi " , "1 " );
110
112
}
111
113
// Due to Varnish parser limitations HTTPS ESIs are not supported so we need to turn them into HTTP URLs
112
- // This does not mean that request will go over HTTP. ESI subrequest will go out to the backend that is
114
+ // This does not mean that request will go over HTTP. ESI subrequest will go out to the backend that is
113
115
// currently specified so if it's HTTPS it will go over HTTPS
114
116
return sprintf (
115
117
'<esi:include src= \'%s \' /> ' ,
0 commit comments