diff options
Diffstat (limited to 'config')
40 files changed, 142 insertions, 27 deletions
diff --git a/config/.cvsignore b/config/.cvsignore deleted file mode 100644 index 2539dd3cd..000000000 --- a/config/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -general -database.yml -rails_env.rb diff --git a/config/alert-tracks-debian.ugly b/config/alert-tracks-debian.example index f1ca68b03..ac4a55c8f 100755 --- a/config/alert-tracks-debian.ugly +++ b/config/alert-tracks-debian.example @@ -24,6 +24,10 @@ DUSER=!!(*= $user *)!! # RAILS_ENV=your_rails_env # export RAILS_ENV +# Uncomment the following line if running under rbenv - we want this daemon to run +# in the context of the ruby version defined for the site +# PATH=/home/!!(*= $user *)!!/.rbenv/shims:/usr/local/bin:/usr/bin:/bin + trap "" 1 export PIDFILE LOGFILE @@ -41,7 +45,7 @@ start_daemon() { } stop_daemon() { - /sbin/start-stop-daemon --stop --oknodo --pidfile "$PIDFILE" + /sbin/start-stop-daemon --stop --oknodo --retry 5 --pidfile "$PIDFILE" } restart() { stop; start; } diff --git a/config/application.rb b/config/application.rb index 3c01e26c4..89b625cb4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- require File.expand_path('../boot', __FILE__) require 'rails/all' @@ -60,7 +61,8 @@ module Alaveteli config.time_zone = ::AlaveteliConfiguration::time_zone # Set the cache to use a memcached backend - config.cache_store = :mem_cache_store, { :namespace => AlaveteliConfiguration::domain } + config.cache_store = :mem_cache_store, + { :namespace => "#{AlaveteliConfiguration::domain}_#{RUBY_VERSION}" } config.action_dispatch.rack_cache = nil config.after_initialize do |app| @@ -69,6 +71,7 @@ module Alaveteli app.routes.append{ match '*path', :to => 'general#not_found' } end + config.autoload_paths << "#{Rails.root.to_s}/app/models/concerns" config.autoload_paths << "#{Rails.root.to_s}/lib/mail_handler" config.autoload_paths << "#{Rails.root.to_s}/lib/attachment_to_html" config.autoload_paths << "#{Rails.root.to_s}/lib/health_checks" @@ -81,6 +84,11 @@ module Alaveteli require "#{Rails.root}/lib/whatdotheyknow/strip_empty_sessions" config.middleware.insert_before ::ActionDispatch::Cookies, WhatDoTheyKnow::StripEmptySessions, :key => '_wdtk_cookie_session', :path => "/", :httponly => true + # Strip non-UTF-8 request parameters + if RUBY_VERSION == '1.9.3' + config.middleware.insert 0, Rack::UTF8Sanitizer + end + # Allow the generation of full URLs in emails config.action_mailer.default_url_options = { :host => AlaveteliConfiguration::domain } if AlaveteliConfiguration::force_ssl @@ -105,10 +113,9 @@ module Alaveteli 'fancybox.js'] # ... while these are individual files that can't easily be # grouped: - config.assets.precompile += ['jquery.Jcrop.css', + config.assets.precompile += ['jquery.Jcrop.min.css', 'excanvas.min.js', 'select-authorities.js', - 'jquery_ujs.js', 'new-request.js', 'fonts.css', 'print.css', @@ -116,6 +123,7 @@ module Alaveteli 'ie6.css', 'ie7.css', 'bootstrap-dropdown.js', + 'widget.css', 'responsive/print.css', 'responsive/application-lte-ie7.css', 'responsive/application-ie8.css'] diff --git a/config/boot.rb b/config/boot.rb index a810be358..25da6546e 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- require 'rubygems' # Set up gems listed in the Gemfile. diff --git a/config/crontab-example b/config/crontab-example index f65555b11..a83f418fa 100644 --- a/config/crontab-example +++ b/config/crontab-example @@ -5,6 +5,10 @@ # Email: hello@mysociety.org. WWW: http://www.mysociety.org/ PATH=/usr/local/bin:/usr/bin:/bin +# Uncomment the following line if running under rbenv - we want this cron to run +# in the context of the ruby version defined for the site +# PATH=/home/!!(*= $user *)!!/.rbenv/shims:/usr/local/bin:/usr/bin:/bin + MAILTO=!!(*= $mailto *)!! # Every 5 minutes @@ -16,9 +20,7 @@ MAILTO=!!(*= $mailto *)!! # Once an hour 09 * * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/alert-comment-on-request.lock !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/alert-comment-on-request || echo "stalled?" - -# Only root can read the log files -31 * * * * root !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/load-mail-server-logs.lock !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/load-mail-server-logs || echo "stalled?" +31 * * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/load-mail-server-logs.lock !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/load-mail-server-logs || echo "stalled?" # Once a day, early morning 31 1 * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/change-xapian-database.lock "!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/compact-xapian-database production !!(*= $site *)!!" || echo "stalled?" diff --git a/config/deploy.rb b/config/deploy.rb index f4a0b536a..6998b3ed7 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- require 'bundler/capistrano' set :stage, 'staging' unless exists? :stage @@ -58,6 +59,7 @@ namespace :deploy do "#{release_path}/log" => "#{shared_path}/log", "#{release_path}/tmp/pids" => "#{shared_path}/tmp/pids", "#{release_path}/lib/acts_as_xapian/xapiandbs" => "#{shared_path}/xapiandbs", + "#{release_path}/lib/themes" => "#{shared_path}/themes", } # "ln -sf <a> <b>" creates a symbolic link but deletes <b> if it already exists @@ -70,6 +72,7 @@ namespace :deploy do run "mkdir -p #{shared_path}/log" run "mkdir -p #{shared_path}/tmp/pids" run "mkdir -p #{shared_path}/xapiandbs" + run "mkdir -p #{shared_path}/themes" end end diff --git a/config/environment.rb b/config/environment.rb index 196680b23..ca436cc29 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- # Load the rails application require File.expand_path('../application', __FILE__) diff --git a/config/environments/development.rb b/config/environments/development.rb index dbf8d7b2a..39bd98da1 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- Alaveteli::Application.configure do # Settings specified here will take precedence over those in config/environment.rb @@ -46,4 +47,12 @@ Alaveteli::Application.configure do # with SQLite, MySQL, and PostgreSQL) config.active_record.auto_explain_threshold_in_seconds = 0.5 + if AlaveteliConfiguration.use_bullet_in_development + config.after_initialize do + Bullet.enable = true + Bullet.bullet_logger = true + Bullet.console = true + Bullet.add_footer = true + end + end end diff --git a/config/environments/production.rb b/config/environments/production.rb index a3e3cebd2..bc5b724d0 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- Alaveteli::Application.configure do # Settings specified here will take precedence over those in config/environment.rb @@ -17,7 +18,20 @@ Alaveteli::Application.configure do # Disable delivery errors, bad email addresses will be ignored # config.action_mailer.raise_delivery_errors = false - config.action_mailer.delivery_method = :sendmail # so is queued, rather than giving immediate errors + + config.action_mailer.delivery_method = AlaveteliConfiguration::production_mailer_delivery_method.to_sym + + if AlaveteliConfiguration::production_mailer_delivery_method.to_sym == :smtp + config.action_mailer.smtp_settings = { + :address => AlaveteliConfiguration::smtp_mailer_address, + :port => AlaveteliConfiguration.smtp_mailer_port, + :domain => AlaveteliConfiguration.smtp_mailer_domain, + :user_name => AlaveteliConfiguration.smtp_mailer_user_name, + :password => AlaveteliConfiguration.smtp_mailer_password, + :authentication => AlaveteliConfiguration.smtp_mailer_authentication, + :enable_starttls_auto => AlaveteliConfiguration.smtp_mailer_enable_starttls_auto + } + end config.active_support.deprecation = :notify diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 0bb0db71a..0d791e03e 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- Alaveteli::Application.configure do # Settings specified here will take precedence over those in config/environment.rb diff --git a/config/environments/test.rb b/config/environments/test.rb index 97c2d4f7c..483a4874f 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- Alaveteli::Application.configure do # Settings specified here will take precedence over those in config/environment.rb diff --git a/config/general.yml-example b/config/general.yml-example index 8acea374b..a6980b71c 100644 --- a/config/general.yml-example +++ b/config/general.yml-example @@ -673,6 +673,14 @@ PUBLIC_BODY_LIST_FALLBACK_TO_DEFAULT_LOCALE: false # --- USE_MAILCATCHER_IN_DEVELOPMENT: true +# Bullet is a tool to help to kill N+1 queries and unused eager loading +# https://github.com/flyerhzm/bullet +# +# USE_BULLET_IN_DEVELOPMENT - Boolean (default: false) +# +# --- +USE_BULLET_IN_DEVELOPMENT: false + # Use memcached to cache HTML fragments for better performance. This will # only have an effect in environments where # config.action_controller.perform_caching is set to true @@ -775,3 +783,38 @@ ALLOW_BATCH_REQUESTS: false # # --- RESPONSIVE_STYLING: true + +# Define the mailer delivery method to be used only in the production environment. +# By default, use sendmail. +# +# The list of accepted options are available in the Rails ActionMailer configuration +# documentation: http://guides.rubyonrails.org/action_mailer_basics.html#example-action-mailer-configuration +# +# The most common alternative is to use 'smtp' +# If you choose to use an external SMTP service then you will need to also include the SMTP configuration settings. +# +# As a string this is coerced into a symbol in config/environments/production.rb +# +# PRODUCTION_MAILER_DELIVERY_METHOD - String (default: sendmail) +# +# Examples: +# +# PRODUCTION_MAILER_DELIVERY_METHOD: smtp +# SMTP_MAILER_ADDRESS: smtp.gmail.com +# SMTP_MAILER_PORT: 587 +# SMTP_MAILER_DOMAIN: example.com +# SMTP_MAILER_USER_NAME: jane322 +# SMTP_MAILER_PASSWORD: supersecretpassword +# SMTP_MAILER_AUTHENTICATION: 'plain' +# SMTP_MAILER_ENABLE_STARTTLS_AUTO: true +# --- +PRODUCTION_MAILER_DELIVERY_METHOD: sendmail + +# If ENABLE_WIDGETS is set to true, Alaveteli will allow the embedding of a +# 'widget' linking to a request on other sites. This widget will record +# how many people click on an 'I also want to know' button. +# +# ENABLE_WIDGETS - Boolean (default: false) +# +# --- +ENABLE_WIDGETS: false diff --git a/config/httpd.conf-example b/config/httpd.conf-example index 00722fbdf..f70068481 100644 --- a/config/httpd.conf-example +++ b/config/httpd.conf-example @@ -25,6 +25,10 @@ PassengerAppRoot /var/www/alaveteli PassengerResolveSymlinksInDocumentRoot on + # Uncomment the following line if you want to run Alaveteli + # with the ruby set by rbenv + # PassengerRuby /home/alaveteli/.rbenv/shims/ruby + # See http://blog.phusion.nl/2013/03/12/tuning-phusion-passengers-concurrency-settings/ # and http://blog.scoutapp.com/articles/2009/12/08/production-rails-tuning-with-passenger-passengermaxprocesses # for more information on tuning Passenger diff --git a/config/initializers/acts_as_xapian.rb b/config/initializers/acts_as_xapian.rb index f82193c85..56eb75ed3 100644 --- a/config/initializers/acts_as_xapian.rb +++ b/config/initializers/acts_as_xapian.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- # acts_as_xapian/init.rb: # # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb index 7c3f9192b..1a35dc5ee 100644 --- a/config/initializers/alaveteli.rb +++ b/config/initializers/alaveteli.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- # MySociety specific helper functions $:.push(File.join(File.dirname(__FILE__), '../../commonlib/rblib')) # ... if these fail to include, you need the commonlib submodule from git @@ -35,7 +36,6 @@ end # Load monkey patches and other things from lib/ -require 'ruby19.rb' require 'activesupport_cache_extensions.rb' require 'use_spans_for_errors.rb' require 'activerecord_errors_extensions.rb' diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 59385cdf3..b5e9a55a2 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. diff --git a/config/initializers/fast_gettext.rb b/config/initializers/fast_gettext.rb index b00524993..c7fcc480b 100644 --- a/config/initializers/fast_gettext.rb +++ b/config/initializers/fast_gettext.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- AlaveteliLocalization.set_default_text_domain('app', File.join(Rails.root, 'locale')) I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) diff --git a/config/initializers/gettext_i18n_rails.rb b/config/initializers/gettext_i18n_rails.rb index ef306682b..3beb2e58b 100644 --- a/config/initializers/gettext_i18n_rails.rb +++ b/config/initializers/gettext_i18n_rails.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- # FIXME: Audit the translations for XSS opportunities. Ultimately it would be # good to get rid of this and explicitly mark strings as html_safe GettextI18nRails.translations_are_html_safe = true diff --git a/config/initializers/has_tag_string.rb b/config/initializers/has_tag_string.rb index 5fa33cc70..c9f66414f 100644 --- a/config/initializers/has_tag_string.rb +++ b/config/initializers/has_tag_string.rb @@ -1,2 +1,3 @@ +# -*- encoding : utf-8 -*- require 'has_tag_string/has_tag_string' diff --git a/config/initializers/health_checks.rb b/config/initializers/health_checks.rb index 7fd1d3dda..f85b7b272 100644 --- a/config/initializers/health_checks.rb +++ b/config/initializers/health_checks.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- Rails.application.config.after_initialize do user_last_created = HealthChecks::Checks::DaysAgoCheck.new( :failure_message => _('The last user was created over a day ago'), diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 9e8b0131f..e3c680d36 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 72aca7e44..9070e0caa 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- # Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index d120b94ae..78b86f92c 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- # Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. diff --git a/config/initializers/secure_headers.rb b/config/initializers/secure_headers.rb index 99730e6b2..af476c78c 100644 --- a/config/initializers/secure_headers.rb +++ b/config/initializers/secure_headers.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- ::SecureHeaders::Configuration.configure do |config| # https://tools.ietf.org/html/rfc6797 diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index ca283d4e0..c582ebc87 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,2 +1,3 @@ +# -*- encoding : utf-8 -*- # Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, :key => '_wdtk_cookie_session' diff --git a/config/initializers/strip_attributes.rb b/config/initializers/strip_attributes.rb index 25f70b2f3..2bdc17f21 100644 --- a/config/initializers/strip_attributes.rb +++ b/config/initializers/strip_attributes.rb @@ -1,2 +1,3 @@ +# -*- encoding : utf-8 -*- require 'strip_attributes/strip_attributes' ActiveRecord::Base.extend(StripAttributes) diff --git a/config/initializers/theme_loader.rb b/config/initializers/theme_loader.rb index 9c79e513c..cdc34fe31 100644 --- a/config/initializers/theme_loader.rb +++ b/config/initializers/theme_loader.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- # This is a global array of route extensions. Alaveteli modules may add to it. # It is used by our config/routes.rb to decide which route extension files to load. $alaveteli_route_extensions = [] diff --git a/config/initializers/xml.rb b/config/initializers/xml.rb new file mode 100644 index 000000000..aefd54214 --- /dev/null +++ b/config/initializers/xml.rb @@ -0,0 +1,2 @@ +ActiveSupport::XmlMini.backend = 'Nokogiri' + diff --git a/config/packages b/config/packages index a6eeb8079..7ed6579ee 100644 --- a/config/packages +++ b/config/packages @@ -31,7 +31,6 @@ ruby ruby1.8 ruby1.8-dev rubygems (>= 1.8.15) -sharutils sqlite3 tnef (>= 1.4.5) ttf-bitstream-vera diff --git a/config/packages.debian-squeeze b/config/packages.debian-squeeze index c34abefde..082f2162b 100644 --- a/config/packages.debian-squeeze +++ b/config/packages.debian-squeeze @@ -29,7 +29,6 @@ ruby ruby1.8 ruby1.8-dev rubygems/squeeze-backports -sharutils sqlite3 tnef ttf-bitstream-vera diff --git a/config/packages.debian-wheezy b/config/packages.debian-wheezy index 4129aa930..3740cd1da 100644 --- a/config/packages.debian-wheezy +++ b/config/packages.debian-wheezy @@ -25,7 +25,6 @@ rake ruby-dev ruby1.9.3 rubygems -sharutils sqlite3 tnef unrtf @@ -35,3 +34,4 @@ wkhtmltopdf-static wv xapian-tools xlhtml +ttf-bitstream-vera diff --git a/config/packages.ubuntu-precise b/config/packages.ubuntu-precise index d97579bc1..d1aa0b670 100644 --- a/config/packages.ubuntu-precise +++ b/config/packages.ubuntu-precise @@ -24,7 +24,6 @@ ruby-bundler ruby1.9.1 ruby1.9.1-dev rubygems -sharutils sqlite3 tnef ttf-bitstream-vera diff --git a/config/packages_development b/config/packages_development index 14ca815a2..d8522ccef 100644 --- a/config/packages_development +++ b/config/packages_development @@ -6,4 +6,4 @@ # # To install, paste this list after `sudo apt-get install` and run. -postgresql sharutils pdftk elinks php5-cli tnef python-yaml +postgresql pdftk elinks php5-cli tnef python-yaml diff --git a/config/preinitializer.rb b/config/preinitializer.rb index 3ad02415d..71112a28e 100644 --- a/config/preinitializer.rb +++ b/config/preinitializer.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- begin require "rubygems" require "bundler" diff --git a/config/purge-varnish-debian.ugly b/config/purge-varnish-debian.example index dc3f74ff6..779266d2d 100755 --- a/config/purge-varnish-debian.ugly +++ b/config/purge-varnish-debian.example @@ -24,6 +24,10 @@ DUSER=!!(*= $user *)!! # RAILS_ENV=your_rails_env # export RAILS_ENV +# Uncomment the following line if running under rbenv - we want this daemon to run +# in the context of the ruby version defined for the site +# PATH=/home/!!(*= $user *)!!/.rbenv/shims:/usr/local/bin:/usr/bin:/bin + type varnishadm > /dev/null 2>&1 || exit trap "" 1 @@ -43,7 +47,7 @@ start_daemon() { } stop_daemon() { - /sbin/start-stop-daemon --stop --oknodo --pidfile "$PIDFILE" + /sbin/start-stop-daemon --stop --oknodo --retry 5 --pidfile "$PIDFILE" } restart() { stop; start; } diff --git a/config/routes.rb b/config/routes.rb index c975d6007..ba378119e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -# encoding: UTF-8 +# -*- encoding : utf-8 -*- # config/routes.rb: # Mapping URLs to controllers for FOIFA. # @@ -65,6 +65,7 @@ Alaveteli::Application.routes.draw do resources :request, :only => [] do resource :report, :only => [:new, :create] + resource :widget, :only => [:new, :show, :update] end resources :info_request_batch, :only => :show @@ -142,6 +143,7 @@ Alaveteli::Application.routes.draw do match '/track/update/:track_id' => 'track#update', :as => :update match '/track/delete_all_type' => 'track#delete_all_type', :as => :delete_all_type match '/track/feed/:track_id' => 'track#atom_feed', :as => :atom_feed + match '/track/widget_vote/:info_request_id' => 'track#widget_vote', :as => :widget_vote #### #### Help controller diff --git a/config/run-with-rbenv-path.example b/config/run-with-rbenv-path.example new file mode 100644 index 000000000..25dec9b60 --- /dev/null +++ b/config/run-with-rbenv-path.example @@ -0,0 +1,8 @@ +#!/bin/bash + +# We want this script to run in the context of the ruby version defined for the site +PATH=/home/!!(*= $user *)!!/.rbenv/shims:$PATH + +source "$1" + +exit $? diff --git a/config/sysvinit-passenger.ugly b/config/sysvinit-passenger.example index 0940a4d63..0940a4d63 100755 --- a/config/sysvinit-passenger.ugly +++ b/config/sysvinit-passenger.example diff --git a/config/sysvinit-thin.ugly b/config/sysvinit-thin.example index 0155ff8c3..0155ff8c3 100755 --- a/config/sysvinit-thin.ugly +++ b/config/sysvinit-thin.example diff --git a/config/varnish-alaveteli.vcl b/config/varnish-alaveteli.vcl index d3726682c..59d76b0d1 100644 --- a/config/varnish-alaveteli.vcl +++ b/config/varnish-alaveteli.vcl @@ -2,10 +2,10 @@ # of Alaveteli. See the vcl(7) man page for details on VCL syntax and # semantics. -# +# # Default backend definition. Set this to point to your content # server. In this case, apache + Passenger running on port 80 -# +# backend default { .host = "127.0.0.1"; @@ -32,7 +32,7 @@ sub vcl_recv { # Sanitise X-Forwarded-For... remove req.http.X-Forwarded-For; set req.http.X-Forwarded-For = client.ip; - + # Remove Google Analytics, has_js, and last-seen cookies set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__[a-z]+|has_js|has_seen_country_message|seen_foi2)=[^;]*", ""); @@ -50,14 +50,14 @@ sub vcl_recv { remove req.http.Accept-Encoding; } } - + # Ignore empty cookies if (req.http.Cookie ~ "^\s*$") { remove req.http.Cookie; } - + if (req.request != "GET" && - req.request != "HEAD" && + req.request != "HEAD" && req.request != "POST" && req.request != "PUT" && req.request != "PURGE" && @@ -70,9 +70,9 @@ sub vcl_recv { /* We only deal with GET and HEAD by default, the rest get passed direct to backend */ return (pass); } - + # Ignore Cookies on images... - if (req.url ~ "\.(png|gif|jpg|jpeg|swf|css|js|rdf|ico|txt)(\?.*|)$") { + if (req.url ~ "\.(png|gif|jpg|jpeg|swf|css|js|rdf|ico)(\?.*|)$") { remove req.http.Cookie; return (lookup); } |