Created
          February 5, 2020 08:54 
        
      - 
      
 - 
        
Save GeertHauwaerts/4d777a52496291dd50dce3b7ba59c869 to your computer and use it in GitHub Desktop.  
    Matomo - Varnish Configuration - VCL
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | probe matomo_health { | |
| .url = "/"; | |
| .interval = 5s; | |
| .timeout = 3s; | |
| .window = 5; | |
| .threshold =3; | |
| } | |
| backend matomo_1 { | |
| .host = "10.0.0.1"; | |
| .port = "80"; | |
| .probe = matomo_health; | |
| } | |
| backend matomo_2 { | |
| .host = "10.0.0.2"; | |
| .port = "80"; | |
| .probe = matomo_health; | |
| } | |
| sub vcl_init { | |
| new matomo = directors.round_robin(); | |
| matomo.add_backend(matomo_1); | |
| matomo.add_backend(matomo_2); | |
| } | |
| sub vcl_recv { | |
| if (req.http.host == "analytics.example.com") { | |
| set req.backend_hint = matomo.backend(); | |
| if (req.url ~ "\.(png|gif|jpg|swf|css|js|ico|svg|woff2)(\?.*|)$") { | |
| unset req.http.cookie; | |
| return (hash); | |
| } | |
| return(pass); | |
| } | |
| } | |
| sub vcl_backend_response { | |
| if (bereq.url == "analytics.example.com") { | |
| set beresp.uncacheable = true; | |
| set beresp.ttl = 60s; | |
| return (deliver); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment