Closed gewaechshaus closed 8 years ago
Tracked down to... Seems like the obj.status isn't set or vcl_error isn't getting triggered.
sub vcl_recv {
if(req.http.host == "www.xxx.at"){
error 750 "http://www.xxx.de";
}
}
sub vcl_error {
if (obj.status == 750) {
set obj.http.Location = obj.response;
set obj.status = 301;
return(deliver);
}
}
Thanks for following up with what you found!
Still didn't find a fix...
Even a error 750 "http://www.xxx.de"; hardcoded in vcl_recv without any conditions doesn't work anymore. vcl_error never gets triggered.
Can u try to reproduce this @aricwatson?
Please re-open. THX
Damn, this issue is mind-blowing simple but far reaching and a time expensive trip to the moon in the end... One had to write "start with the simplest, start with simplest, start with simplest when debugging" on the board. A programmers nature looks slightly different :).
It looks like all custom overwrites from custom.vcl aren't working anymore cause of the changed structure...
@aricwatson We've verified this the following way: Put a file called farnish.php (yeah f*ck varnish ;) :). it's a secret affair) in the magento root directory including the following code
<?php
var_dump(microtime());
Add
if (req.url ~ "^/farnish\.php$") {
return(pass);
}
in your custom.vcls vcl_recv. File is getting cached in our case...
Next step we went ahead with adding
if (req.url ~ "^/farnish\.php$") {
error 750 "http://www.xxx.at";
}
in default.vcl vcl_recv before
if (req.restarts == 0) {
and just reload varnishd. TaDaa - redirects working. That also assumes that the overwrites only (logical) aren't working, cause the custom sub vcl_error routines are triggered. So i shouldn't be related to parsing stopping at point x.
@aricwatson - did u find the time to have a look at it?
@gewaechshaus Sorry been quite busy - FWIW we did run into a similar problem recently and found it was related to using the Normalize Host configuration option in Turpentine. Turning that to off fixed some htaccess based redirect issues that we were having.
Since you're (trying) to do this in the VCL - I wonder if the problem you're running into is that your custom VCL code is getting overridden. Can you try https://github.com/nexcess/magento-turpentine/pull/1212 to see if it'll give you better control over your generated VCL?
@aricwatson - No problem... Like Bob Marley said, every day is work ;) We did turn off normalization as we ran into serious session troubles in our multistore setup. Currently we're running a custom vcl, but #1212 looks more tidy than our dirty approach. Thx a lot, i'll post some feedback asap.
Hey there,
after updating turpentine to 0.6.9 I noticed that some of our redirects aren't working anymore. Does anybody did notice issues related to that? We're using a self-compiled varnish 3 version.
custom.vcl, stripped down
X-TC and X-TCX are returning the correct values to match the condition... "DE" "www.xxx.at"
https://www.varnish-cache.org/trac/wiki/VCLExampleRedirectInVCL
Best regards Jan