This file contains 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
from django.views.decorators.cache import decorator_from_middleware_with_args | |
from django.middleware.cache import CacheMiddleware | |
class LocalCacheMiddleware(CacheMiddleware): | |
def process_request(self, request): | |
response = super(LocalCacheMiddleware, self).process_request(request) | |
# Add X-Cache: HIT header if response is returned from cache | |
if response: | |
response['X-Cache'] = 'HIT' |
This file contains 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
#!/bin/bash | |
#Requirements: etckeeper, diffcolor | |
#This script concatenates multiple files of haproxy configuration into | |
#one file, and than checks if monolithic config contains errors. If everything is | |
#OK with new config script will write new config to $CURRENTCFG and reload haproxy | |
#Also, script will commit changes to etckeeper, if you don't use etckeeper you | |
#should start using it. | |
#Script assumes following directory structure: | |
#/etc/haproxy/conf.d/ |
This file contains 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
# Monitoring HAProxy via CSV stats | |
# For detailed instructions visit http://lazic.info/josip/post/monitor-haproxy-via-prtg/ | |
# Josip Lazic | |
param( | |
[string]$url, | |
[string]$monitor | |
); | |
$templates =@{ |