Magento Varnish and Turpentine Error wiht Paypal

  • Posted on: 23 February 2013
  • By: markus.wilhelm

I had an error in my Magento Shop with 1.7 using Varnish and Turpentine extension. The redirect page from Magento to Paypal was cached and my customers did have a different basket in Paypal then the had previously in Magento. I changed the varnish config in the vcl_recv Funktion and added the following line:

Old:

if (req.restarts == 0) {
        if (req.http.X-Forwarded-For) {
            set req.http.X-Forwarded-For =
            req.http.X-Forwarded-For + ", " + client.ip;
        } else {
            set req.http.X-Forwarded-For = client.ip;
        }
    }
    set req.http.X-Turpentine-Secret-Handshake = "1";
     
         
    if (req.request !~ "^(GET|HEAD|PUT|POST|TRACE|DELETE|OPTIONS)$") {
        return (pipe);
    }

New:

if (req.restarts == 0) {
        if (req.http.X-Forwarded-For) {
            set req.http.X-Forwarded-For =
            req.http.X-Forwarded-For + ", " + client.ip;
        } else {
            set req.http.X-Forwarded-For = client.ip;
        }
    }
    set req.http.X-Turpentine-Secret-Handshake = "1";
     
    if (req.url ~ "^/paypal") {
        return (pass);
    }
     
         
    if (req.request !~ "^(GET|HEAD|PUT|POST|TRACE|DELETE|OPTIONS)$") {
        return (pipe);
    }

BR Markus