Tag Archives: apache

Simple HTTP Access Authorisation

sometimes you may want to lock down RESTful APIs or plain HTTP GET resources for authorised access by your own client software only, without requiring authentication. You don’t know who (not authenticated), but you know she may access (is authorised). If the server has a valid SSL certificate based on a root certificate pre-installed on the […]

Automatic gzip compression for Apache2 Webservers

after failing and failing again in the last months, I finally got it with the help of http://www.debian-administration.org/articles/137 The .htaccess configuration AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascriptAddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript requires Apache’s mod_deflate enabled via $ a2enmod deflate Module deflate installed; run /etc/init.d/apache2 force-reload to enable.$ a2enmod deflate Module deflate installed; […]

hübsche Dropbox Links

Weil große Email Anhänge stinken, bietet sich z.B. die Dropbox als Dateiaustauschplatform an. Einfach die Datei in den (lokalen) Dropbox/Public Ordner verfrachten, syncen lassen und per „Rechte Maustaste -> Copy Public Link“ in die Mail kopieren. Redirect Nun sind solche Links nicht besonders hübsch (Branding!, Branding!, CI! ruft die Marketingabteilung) und  spätestens wenn man’s abtippen […]

ruby: parse Apache Serverlogs

Yields a hashmap for every line: require ‚date‘   class Apache def self.each_request(src=$stdin) ip_pat=/(?:[0-9]+\.){3}[0-9]+/ date_pat=/\[[^\]]+\]/ req_pat=/"([A-Z]+)\s([^\s]+)\s([^\s]+)"/ ref_pat=/"([^"]+)"/ date_fmt = ‚[%d/%b/%Y:%H:%M:%S %Z]‘ apache_pat = Regexp.new( "(#{ip_pat})\s([^\s]+)\s([^\s]+)\s" < < "(#{date_pat})\s#{req_pat}\s([0-9]+)\s(-|[0-9]+)\s#{ref_pat}\s#{ref_pat}") src.each_line do |l| m = apache_pat.match l if m r = { :ip => m[1], :uid => m[2], :auth => m[3], :date => DateTime.strptime(m[4],date_fmt), :method => m[5], […]