All posts by Mike Dixson

FIXED: Varnish Caching Proxy Expected an action, ‘if’, ‘{‘ or ‘}’

So it seems Varnish 4.0 and 4.1 (more may be affected this is the limit of my testing presently) has a bug where some whitespace can through it from recognising valid configuration such as below
# ACLs to control who can access this caching proxy server
acl local {
"127.0.0.0"/8; /* loopback range */
"192.168.1.0"/29; /* local network range 192.168.1.0-192.168.1.7 */
"10.0.0.0"/8; /* For testing on own hown network - REMOVE FOR PRODUCTION */
}

######################
# Urls to cache
# /api/3.0/artists/
# /api/3.0/venues/
#####################

sub vcl_recv {
# Happens before we check if we have this in cache already.
#
# Typically you clean up the request here, removing cookies you don’t need,
# rewriting the request, etc.

if (client.ip !~ local ) {
{error 403 “Access denied”;}
}
return (lookup);

# We only want to cache GET request
if (req.request == “GET”) {
return(hash);
}
}

 

This was due to a bad code merge cited here https://github.com/nexcess/magento-turpentine/pull/1311

You can resolve this by manually removing the whitespace by using the command below

cat default-withWhiteSpace.vcl | tr -d " \t\n\r" > default.vcl

Linux CP Making a Backup of a file with a user defined suffix

I use this handy command so often that I’d forgotten to make a note of it here for everyone.

If you want to make a copy of a file with the same filename and a predetermined suffix of your choice then run this command replaceing the YYYYMMDD date with anything you want:

cp haproxy.cfg{,.20170209}

The above command copies haproxy.cfg into a file called haproxy.cfg.20170209
Anything after the comma can be changed as you wish.

Solved: Updating partition details… Unable to open zip file. Error flashing zip

When trying to flash my old Motorola Xoom using this excellent guide http://www.xda-developers.com/motorola-xoom-still-alive-and-kicking-receives-functional-kitkat/ I was unable to flash the system and google apps zips from TWRP and received the following error:

Updating partition details...
Unable to open zip file.
Error flashing zip '/sdcard/update.zip

The error wasn’t quite verbose enough. I found when I tried to have another stab at flashing the recovery partition Android was more helpful and told me that the battery level was too low.

Plugging the device in I was able to flash the device straight away and bring my Xoom back to life and make use of an old tablet again!