{ "info": { "author": "Ingeniweb", "author_email": "support@ingeniweb.com", "bugtrack_url": null, "classifiers": [ "Framework :: Zope2", "Programming Language :: Python", "Topic :: Internet :: Proxy Servers", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "=======================\niw.recipe.squid package\n=======================\n\n.. contents::\n\nWhat is iw.recipe.squid ?\n=========================\n\nInstall squid proxy server and all specific python script in order to work with\nan zope server or an zeo cluster\n\nDo you have an example of build out ?\n=====================================\n\nAdd into your `buildout.cfg` a section::\n\n [buildout]\n parts =\n ...\n squid\n\n [squid]\n recipe = iw.recipe.squid\n\n squid_accelerated_hosts =\n www.mysite.org: 127.0.0.1:8080/mysite\n\nwhere options are:\n\n\n- squid_accelerated_hosts : a list that configure your zope backend like this\n pattern::\n\n visible_host_name: :/\n\noptionnal options are:\n\n- url : url to download squid src in order to compile it (todo)\n- squid_owner : squid_owner of squid process (user login by default)\n- location: location of squid install (by default parts-directory/squid of buildout)\n- squid_visible_hostname: host name show in error messages (by default the first\n visible_host_name in squid_accelerated_host , www.mysite.org )\n- squid_port : port of squid (3128 by default)\n- squid_version : version of squid (2.6 by default)\n- squid_localisation : where squid is for apache (127.0.0.1 by default, squid and\n apache are in the same host)\n- squid_executable : location of squid binary executable (by default /usr/sbin/squid)\n- squid_admin_email : email of the admin squid (by default webmaster@www.mysite.org)\n- squid_cache_size_mb : size disk cache in mb (1000 by default)\n- squid_config_dir : the config directory of squid ( parts-directory/squid/etc by default)\n- squid_cache_dir : the cache localisation of squid (parts-directory/squid/cache by default)\n- squid_log_dir : the log localisation of squid (parts-directory/squid/log by default)\n- apache_conf_dir : the apache config dir (parts-directory/squid/apache by default)\n- front_http : 1 by default (ie apache serve http request)\n- front_https : 0 by default (ie apache serve https request)\n- debug_redirector : 0 by default (ie debug squid redirector)\n- debug_squid_acl : 0 by default (ie debug squid acl)\n- debug_squid_rewrite_rules : 0 by default (ie debug squid acl)\n- debug_apache_rewrite_rules : 0 by default (ie debug apache rewrite rules , 9 for full debug)\n- zope_cache_key : a list of zope cache key (if you want to cache specific\n zone of your site add specific acl)\n- bind_apache_http : binding ip\\:port of apache (80 by default in http, can be only port configure)\n- bind_apache_https : binding ip\\:port of apache (443 by default in https, can be only port configure)\n- squid_extra_conf : extra conf for squid \n\nbuildout command create a directory structure like that::\n\n parts/squid/apache/vhost_www.mysite.org_80.conf : virtual host to include to apache\n parts/squid/etc/ : all config file for squid\n parts/squid/etc/squid.conf : main squid conf\n parts/squid/etc/iRedirector.py : to launch squidRewriteRules\n parts/squid/etc/squidAcl.py : avoid cache for authenticated user by squid\n parts/squid/etc/squidRewriteRules.py : rewrite engine for squid\n parts/squid/etc/squid_logrotate.conf : config for log rotate system (for logrotate system)\n parts/squid/cache/ : cache directory\n parts/squid/log/ : logs directory\n parts/squid/var/ : var directory, contains pid file\n bin/squidctl : squid controler shell script (for unix),\n Usage: squidctl {start|stop|reload|restart|status|debug|purgecache|createswap|configtest|rotate}\n\n\n\nWhat about squid and apache after conf generation ?\n===================================================\n\nApache\n++++++\n\nActivate virtual hosts by making a symbolic link\n\nIn debian::\n\n ln -s .../parts/squid/apache/vhost_www.mysite.org_80.conf /etc/apache2/sites-enabled/\n\nMake sure that mod_rewrite, mod_proxy are enabled for apache\n\nLogs are in parts/squid/log\n\nSquid\n+++++\n\nTo populate squid directory cache::\n\n /usr/sbin/squid -z -f parts/squid/etc/squid.conf OR\n bin/squidctl createswap\n\nTo launch squid the generated config::\n\n /usr/sbin/squid -f parts/squid/etc/squid.conf OR\n bin/squidctl start\n\nThat all's folk\n\n\nHow to use iw.recipe.squid ?\n============================\n\n\nAs a recipe, you have to provide a part in your buildout file\nTest first the most simple part that we can configure::\n\n\n >>> import getpass\n >>> owner = group = getpass.getuser()\n >>> import os\n >>> data_dir = os.path.join(test_dir, 'data')\n >>> parts_dir = os.path.join(data_dir, 'parts')\n >>> buildout = {'instance': {'location': test_dir},\n ... 'buildout': {'directory': test_dir,\n ... 'parts-directory': test_dir}}\n >>> name = 'squid'\n >>> options = {'url': 'mypackage.tgz', #url where we download squid src\n ... 'squid_owner' : 'proxy',\n ... }\n >>> options['squid_accelerated_hosts'] = \"\"\"\n ... www.mysite.com: 127.0.0.1:8080/mysite\n ... \"\"\"\n >>> options['squid_extra_conf'] = \"\"\"\n ... refresh_pattern . 0 20% 1440 \n ... \"\"\"\n\n Creating the recipe::\n\n >>> from iw.recipe.squid import Recipe\n >>> recipe = Recipe(buildout, name, options)\n\n Test that zope conf is good::\n\n >>> recipe.zope_confs\n [{'zope_host': '127.0.0.1', 'zope_path': 'mysite', 'host_name': 'www.mysite.com', 'zope_port': '8080'}]\n\n >>> recipe.options['squid_visible_hostname']\n 'www.mysite.com'\n\n >>> recipe.options['front_https']\n '0'\n\n >>> recipe.options['squid_admin_email']\n 'webmaster@www.mysite.com'\n\n >>> recipe.options['squid_version']\n '2.6'\n\n >>> recipe.options['binary_location']\n '.../bin'\n\n >>> paths = recipe.install()\n\nChecking the files created::\n\n\n >>> paths.sort()\n >>> paths\n ['...squid/tests/bin/squidctl', '...squid/tests/squid/apache/vhost_www.mysite.com_80.conf', '...squid/tests/squid/etc/iRedirector.py', '...squid/tests/squid/etc/squid.conf', '...squid/tests/squid/etc/squidAcl.py', '...squid/tests/squid/etc/squidRewriteRules.py', '...squid/tests/squid/etc/squid_logrotate.conf']\n\n\n\nThe default generated squid.conf\n++++++++++++++++++++++++++++++++\n\n >>> cfg = os.path.join(recipe.options['prefix'], 'etc', 'squid.conf')\n >>> print open(cfg).read()\n # squid configuration file\n \n # BASIC CONFIGURATION\n # ------------------------------------------------------------------------------\n # TAG: visible_hostname\n # If you want to present a special hostname in error messages, etc,\n # define this. Otherwise, the return value of gethostname()\n # will be used. If you have multiple caches in a cluster and\n # get errors about IP-forwarding you must set them to have individual\n # names with this setting.\n visible_hostname www.mysite.com\n \n cache_effective_user proxy\n cache_effective_group proxy\n \n # port on which to listen\n \n http_port 3128 vhost defaultsite=www.mysite.com\n \n \n cache_dir ufs .../squid/cache 1000 16 256\n cache_mgr webmaster@www.mysite.com\n \n \n \n # LOGS\n # ------------------------------------------------------------------------------\n log_icp_queries off\n cache_access_log .../squid/log/access.log\n cache_log .../squid/log/cache.log\n cache_store_log .../squid/log/store.log\n # emulate_httpd_log off\n \n \n # RESOURCES\n # ------------------------------------------------------------------------------\n # amount of memory used for caching recently accessed objects - defaults to 8 MB\n cache_mem 64 MB\n maximum_object_size 10 MB # max cached object size\n maximum_object_size_in_memory 300 KB # max cached-in-memory object size\n \n \n # ACCESS CONTROL\n # ------------------------------------------------------------------------------\n \n # Basic ACLs\n acl all src 0.0.0.0/0.0.0.0\n acl localhost src 127.0.0.1/32\n acl ssl_ports port 443 563\n acl safe_ports port 80 443\n \n \n acl zope_servers src 127.0.0.1\n #acl zope_servers src 127.0.0.1\n \n acl manager proto cache_object\n acl connect method connect\n \n # Assumes apache rewrite rule looks like this:\n # RewriteRule ^/(.*)/$ http://127.0.0.1:3128/http/%{SERVER_NAME}/80/$1 [L,P]\n \n acl accelerated_protocols proto http\n acl accelerated_hosts dst 127.0.0.0/8\n acl accelerated_ports myport 3128\n acl accelerated_urls urlpath_regex __original_url__\n acl accelerated_urls urlpath_regex __zope_cache_key__.*__cache_url__\n \n \n http_access allow accelerated_hosts\n http_access allow accelerated_ports\n http_access allow accelerated_urls\n http_access allow accelerated_protocols\n \n always_direct allow accelerated_hosts\n always_direct allow accelerated_ports\n \n \n \n # Purge access - zope servers can purge but nobody else\n acl purge method PURGE\n http_access allow zope_servers purge\n http_access deny purge\n \n # Reply access\n # http_reply_access allow all\n \n # Cache manager setup - cache manager can only connect from localhost\n # only allow cache manager access from localhost\n http_access allow manager localhost\n http_access deny manager\n # deny connect to other than ssl ports\n http_access deny connect !ssl_ports\n \n # ICP access - anybody can access icp methods\n icp_access allow localhost zope_servers\n \n # And finally deny all other access to this proxy\n http_access deny all\n \n \n # CACHE PEERS\n # ------------------------------------------------------------------------------\n \n # CONFIGURE THE CACHE PEERS. FIRST PORT IS THE HTTP PORT, SECOND PORT\n # IS THE ICP PORT. REMEMBER TO ENABLE 'icp-server' ON YOUR 'zope.conf'\n # LISTENING ON THE ICP PORT YOU USE HERE.\n # acl in_backendpool dstdomain backendpool\n # cache_peer 127.0.0.1 parent 8080 9090 no-digest no-netdb-exchange\n # cache_peer 192.168.0.3 parent 8081 9091 no-digest no-netdb-exchange\n \n # cache_peer_access 127.0.0.1 allow in_backendpool\n # cache_peer_access 127.0.0.1 deny all\n \n # cache_peer_access 192.168.0.3 allow in_backendpool\n # cache_peer_access 192.168.0.3 deny all\n \n # IF YOU NEED TO FORWARD REQUESTS TO HOSTS NOT IN THE POOL THIS IS\n # WHERE YOU ALLOW THE TARGET DOMAINS\n # acl local_servers dstdomain some.mysite.com other.mysite.com\n # always_direct allow local_servers\n \n # THE FOLLOWING DIRECTIVE IS NEEDED TO MAKE 'backendpool' RESOLVE TO\n # THE POOL OF CACHE PEERS.\n # never_direct allow all\n # icp_access allow all\n \n # PROXY ON, NEEDED TO MAKE CACHE PEERS INTERCOMMUNICATE\n # httpd_accel_with_proxy on\n \n \n # REDIRECTOR PROGRAM\n # ------------------------------------------------------------------------------\n \n \n redirect_program .../squid/etc/iRedirector.py\n url_rewrite_children 1\n url_rewrite_concurrency 20\n url_rewrite_host_header off\n \n \n # SPECIFY WHAT REQUESTS SQUID SHOULD CACHE\n # ------------------------------------------------------------------------------\n \n # Control what squid caches. We want to have squid handle content that is not\n # personalized and that does not require any kind of authorization.\n # 1) Always cache static content in squid\n \n acl static_content urlpath_regex -i \\.(jpg|jpeg|gif|png|tiff|tif|svg|swf|ico|css|js|vsd|doc|ppt|pps|xls|pdf|mp3|mp4|m4a|ogg|mov|avi|wmv|sxw|zip|gz|bz2|tgz|tar|rar|odc|odb|odf|odg|odi|odp|ods|odt|sxc|sxd|sxi|sxw|dmg|torrent|deb|msi|iso|rpm)$\n no_cache allow static_content\n \n # 2) (OPTIONAL) Prevent squid from caching an item that is the result of a POST\n \n acl post_requests method POST\n no_cache deny post_requests\n \n # 3) (OPTIONAL) Prevent squid from caching items with items in the query string\n # If this is uncommented, squid will treat a url with 2 different query strings\n # as 2 different urls when caching.\n \n # XXX: where did this example go?\n \n \n acl zope_key_caching urlpath_regex d41d8cd98f00b204e9800998ecf8427e\n no_cache allow zope_key_caching\n \n \n \n # 4) Prevent squid from caching requests from authenticated users or conditional\n # GETs with an If-None-Match header (since squid doesn't know about ETags)\n # We use an external python method to check these conditions and pass in the\n # value of the __ac cookie (two different ways to allow for different cookie\n # delimiters), the HTTP Authorization header, and the If-None-Match header.\n # Squid caches the results of the external python method, so for debugging, set\n # the options ttl=0 negative_ttl=0 so you can see what is going on\n \n # external_acl_type is_cacheable_type children=20 ttl=0 negative_ttl=0 %{Cookie:__ac} %{Cookie:;__ac} %{Authorization} %{If-None-Match} .../squid/etc/squidAcl.py\n \n external_acl_type is_cacheable_type protocol=2.5 children=20 %{Cookie:__ac} %{Cookie:;__ac} %{Authorization} %{If-None-Match} .../squid/etc/squidAcl.py\n acl is_cacheable external is_cacheable_type\n no_cache allow is_cacheable\n \n collapsed_forwarding on\n \n # Explicitly disallow squid from handling anything else\n \n \n \n \n no_cache deny all\n \n \n # SPECIFY EFFECTS OF A BROWSER REFRESH\n # ------------------------------------------------------------------------------\n \n # RELOAD_INTO_IMS CAUSES WEIRD SQUID BEHAVIOR - IT APPEARS TO CAUSE FILES WITH\n # INAPPROPRIATE HEADERS TO END UP IN THE CACHE, AND AS A RESULT BROWSERS END\n # UP MAKING LOTS OF EXTRA (CONDITIONAL) REQUESTS WHEN THEY WOULD OTHERWISE MAKE\n # NO REQUESTS. DO NOT USE!\n \n # Tell squid how to handle expiration times for content with no explicit expiration\n # Assume static content is fresh for at least an hour and at most a day\n #refresh_pattern -i \\.(jpg|jpeg|gif|png|tiff|tif|svg|swf|ico|css|js|vsd|doc|ppt|pps|xls|pdf|mp3|mp4|m4a|ogg|mov|avi|wmv|sxw|zip|gz|bz2|tar|rar|odc|odb|odf|odg|odi|odp|ods|odt|sxc|sxd|sxi|sxw|dmg|torrent|deb|msi|iso|rpm)$ 60 50% 1440 reload-into-ims\n #refresh_pattern . 0 20% 1440\n \n # Change force-refresh requests into conditional gets using if-modified-since\n #reload_into_ims on\n \n # DEBUGGING\n # ------------------------------------------------------------------------------\n # debug_options ALL,1 33,2 # use this for debugging acls\n # debug_options ALL,8\n \n \n # MISCELLANEOUS\n # ------------------------------------------------------------------------------\n # have squid handle all requests with ranges\n # range_offset_limit -1\n \n # amount of time squid waits for existing requests to be serviced before shutting down\n shutdown_lifetime 1 seconds\n \n # allow squid to process multiple requests simultaneously if client is pipelining\n pipeline_prefetch on\n \n # allow white spaces to be included in URLs\n uri_whitespace allow\n \n \n # OTHER PARAMETERS THAT MAY BE OF INTEREST\n # ------------------------------------------------------------------------------\n \n # logfile_rotate 0\n # reload_into_ims off\n # error_directory /usr/share/squid/errors/\n \n pid_filename .../squid/var/squid.pid\n \n \n refresh_pattern . 0 20% 1440 \n \n\nThe default generated squidRewriteRules.py\n++++++++++++++++++++++++++++++++++++++++++\n\n\n >>> cfg = os.path.join(recipe.options['prefix'], 'etc', 'squidRewriteRules.py')\n >>> print open(cfg).read()\n #!...\n rewrites = (\n (r'http://[^/]+/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*)/__original_url__/(.*)',\n r'http://\\1:\\2/VirtualHostBase/\\3/\\4:\\5/\\6/VirtualHostRoot/\\7', 'P,L'),\n (r'http://[^/]+/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*)/__zope_cache_key__/(.*)/__cache_url__/(.*)',\n r'http://\\1:\\2/VirtualHostBase/\\3/\\4:\\5/\\6/VirtualHostRoot/\\7/\\8', 'P,L'),\n \n )\n ...\n\nThe default generated conf for apache\n+++++++++++++++++++++++++++++++++++++\n\n >>> cfg = os.path.join(recipe.options['prefix'], 'etc', 'squidRewriteRules.py')\n >>> print open(cfg).read()\n #!...\n\n >>> cfg = os.path.join(recipe.options['prefix'], 'apache', 'vhost_www.mysite.com_80.conf')\n >>> print open(cfg).read()\n NameVirtualHost *:80\n \n ServerName www.mysite.com\n \n \n Allow from all\n \n \n \n RewriteEngine On\n RewriteLog .../squid/log/rewrite_www.mysite.com.log\n RewriteLogLevel 0\n \n CustomLog .../squid/log/access_www.mysite.com.log common\n ErrorLog .../squid/log/error_www.mysite.com.log\n \n RewriteRule ^(.*)$ - [E=BACKEND_LOCATION:127.0.0.1]\n RewriteRule ^(.*)$ - [E=BACKEND_PORT:8080]\n RewriteRule ^(.*)$ - [E=BACKEND_PATH:mysite]\n \n \n RewriteRule ^/(.*)/$ http://127.0.0.1:3128/%{ENV:BACKEND_LOCATION}/%{ENV:BACKEND_PORT}/http/%{SERVER_NAME}/80/%{ENV:BACKEND_PATH}/__original_url__/$1 [L,P]\n RewriteRule ^/(.*)$ http://127.0.0.1:3128/%{ENV:BACKEND_LOCATION}/%{ENV:BACKEND_PORT}/http/%{SERVER_NAME}/80/%{ENV:BACKEND_PATH}/__original_url__/$1 [L,P]\n \n \n \n \n\n/bin/squidacl file\n++++++++++++++++++\n\n >>> f = open(os.path.join(recipe.options['binary_location'],'squidctl'))\n >>> print f.read()\n #!/bin/sh\n ...\n DAEMON=/usr/sbin/squid\n CONFIG=.../squid/etc/squid.conf\n CACHE_DIR=.../squid/cache\n ...\n\netc/squid_logrotate.conf\n++++++++++++++++++++++++\n\n >>> cfg = os.path.join(recipe.options['prefix'], 'etc', 'squid_logrotate.conf')\n >>> print open(cfg).read()\n /.../squid/var/*.log {\n weekly\n compress\n delaycompress\n maxage 730\n rotate 104\n size=+4096k\n notifempty\n missingok\n create 740 proxy proxy\n postrotate\n .../bin/squidctl rotate\n endscript\n }\n\n\n\nMore options\n++++++++++++\n\nGive more options to the recipe::\n\n >>> options = {'url': 'mypackage.tgz', #url where we download squid src\n ... 'squid_owner': owner, #owner of squid process\n ... 'squid_group' : group, #group of squid process\n ... 'squid_port' : '3128', #listen port of proxy\n ... 'squid_version' : '2.5',\n ... 'squid_localisation': '127.0.0.1', #host or ip that apache use to request apache\n ...\n ... 'squid_admin_email' : 'myemail@mycompany.com', #name appear in error message\n ... 'squid_cache_size_mb' : '1000', #total cache in disk\n ... 'squid_visible_hostname' : 'mysite', #public name of your site, appear in error message\n ... 'front_https': '1', # does front server (apache, iis)\n ... # serve https url O by default\n ... 'front_http':'1', # does front server (apache, iis) serve http url\n ... 'bind_apache_http':'81', # change the default binding port of apache\n ... 'debug_redirector':'1', #debug iRedirector 0 by default\n ... 'debug_squid_acl' : '0', #debug squidacl 0 by default\n ... 'debug_squid_rewrite_rules' : '1', #debug squidtrewriterule 0 by default\n ... 'debug_apache_rewrite_rules' : '9', #debug apache rewrite engine\n ... }\n\n\nYours accelerated hosts ( zeo client or pound load balancer ,\nurls to be accelerated wich corresponding of zope urls, ports, and directories)::\n\n >>> options['squid_accelerated_hosts'] = \"\"\"\n ... www.mysite.com: 127.0.0.1:8080/mysite\n ... mysite.com: 127.0.0.1:8080/mysite\n ... www.mysecondsite.com: 127.0.0.2:9080/mysite2\n ... mysecondsite.com: 127.0.0.2:9080/mysite2\n ... \"\"\"\n\nThis parts is optionnal. We can cache in proxy some part of navigation via\nspecific configuration. This is sometimes usefull to cache zope pages per groups\nor via specific cookies rules. This configuration is done by zope_cache_keys.\nBe carefull : CMFSquid don't purge this url without an intervention of your part.\nAssumes that zope_cache_keys are cookies that is send by zope\nand you have created a folder in zodb name as your cache key to do job acquisition\nSpecific rewrites rules and squid are build::\n\n >>> options['zope_cache_key'] = \"\"\"\n ... my_key_one\n ... my_key_two\n ... my_key_three\n ... \"\"\"\n\n\nCreating the recipe::\n\n >>> from iw.recipe.squid import Recipe\n >>> recipe = Recipe(buildout, name, options)\n\nTest that zope conf is good::\n\n >>> recipe.zope_confs\n [{'zope_host': '127.0.0.1', 'zope_path': 'mysite', 'host_name': 'www.mysite.com', 'zope_port': '8080'}, {'zope_host': '127.0.0.1', 'zope_path': 'mysite', 'host_name': 'mysite.com', 'zope_port': '8080'}, {'zope_host': '127.0.0.2', 'zope_path': 'mysite2', 'host_name': 'www.mysecondsite.com', 'zope_port': '9080'}, {'zope_host': '127.0.0.2', 'zope_path': 'mysite2', 'host_name': 'mysecondsite.com', 'zope_port': '9080'}]\n\n\nZope acl are ip or host that is configure in squid in order\nto be host or ip authorized to purge cache squid.\n\nTest zope acl::\n\n >>> recipe.options['acl_zope_hosts']\n '127.0.0.2 127.0.0.1'\n\nTest rewrites rules::\n\n >>> recipe.cache_key\n ['my_key_one', 'my_key_two', 'my_key_three']\n\n\n\nRunning it::\n\n\n >>> paths = recipe.install()\n\nChecking the files created::\n\n >>> path = recipe.options['prefix']\n\nChecking the squid.conf created::\n\n >>> cfg = os.path.join(path, 'etc', 'squid.conf')\n >>> print open(cfg).read()\n # squid configuration file\n ...\n http_port 3128\n ...\n httpd_accel_host virtual\n httpd_accel_port 81\n httpd_accel_uses_host_header on\n ...\n redirect_children 20\n redirect_rewrites_host_header off\n ...\n\nChecking if we have generate iRedirector conf::\n\n >>> cfg = os.path.join(path, 'etc', 'iRedirector.py')\n >>> print open(cfg).read()\n #!...\n threaded = 0...\n\n >>> cfg = os.path.join(path, 'etc', 'squidAcl.py')\n >>> print open(cfg).read()\n #!...\n\nTest the change of default apache binding\n\n >>> cfg = os.path.join(recipe.options['prefix'], 'apache', 'vhost_www.mysite.com_81.conf')\n >>> print open(cfg).read()\n Listen *:81\n NameVirtualHost *:81\n ...\n\n\n\nRechange apache config::\n\n >>> options['bind_apache_http'] = '80'\n >>> recipe = Recipe(buildout, name, options)\n >>> paths = recipe.install()\n >>> cfg = os.path.join(recipe.options['prefix'], 'apache', 'vhost_www.mysite.com_80.conf')\n >>> print open(cfg).read()\n NameVirtualHost *:80\n ...\n\n >>> options['bind_apache_http'] = '192.168.2.1:80'\n >>> recipe = Recipe(buildout, name, options)\n >>> paths = recipe.install()\n >>> cfg = os.path.join(recipe.options['prefix'], 'apache', 'vhost_www.mysite.com_80.conf')\n >>> print open(cfg).read()\n Listen 192.168.2.1:80\n NameVirtualHost 192.168.2.1:80\n ...\n\nView cache key generation config in apache::\n\n >>> print open(cfg).read()\n Listen 192.168.2.1:80\n ...\n \n RewriteRule ^(.*)$ - [E=BACKEND_LOCATION:127.0.0.1]\n RewriteRule ^(.*)$ - [E=BACKEND_PORT:8080]\n RewriteRule ^(.*)$ - [E=BACKEND_PATH:mysite]\n \n RewriteRule ^(.*)$ - [E=have_cookie:1]\n RewriteCond %{HTTP_COOKIE} my_key_one=\"([^\"]+) [NC]\n RewriteRule ^(.*)$ - [E=my_key_one:%1]\n #test if have cookie\n RewriteCond %{HTTP_COOKIE} !^.*my_key_one.*$ [NC]\n RewriteRule ^(.*)$ - [E=have_cookie:0]\n RewriteCond %{HTTP_COOKIE} my_key_two=\"([^\"]+) [NC]\n RewriteRule ^(.*)$ - [E=my_key_two:%1]\n #test if have cookie\n RewriteCond %{HTTP_COOKIE} !^.*my_key_two.*$ [NC]\n RewriteRule ^(.*)$ - [E=have_cookie:0]\n RewriteCond %{HTTP_COOKIE} my_key_three=\"([^\"]+) [NC]\n RewriteRule ^(.*)$ - [E=my_key_three:%1]\n #test if have cookie\n RewriteCond %{HTTP_COOKIE} !^.*my_key_three.*$ [NC]\n RewriteRule ^(.*)$ - [E=have_cookie:0]\n \n RewriteCond %{ENV:have_cookie} 1\n RewriteRule ^/(.*)$ http://127.0.0.1:3128/%{ENV:BACKEND_LOCATION}/%{ENV:BACKEND_PORT}/https/%{SERVER_NAME}/80/%{ENV:BACKEND_PATH}/__zope_cache_key__/41d154089fd778d8efbd889dffc18dbd:%{ENV:my_key_one}:%{ENV:my_key_two}:%{ENV:my_key_three}/__cache_url__/$1 [L,P]\n \n RewriteRule ^/(.*)/$ http://127.0.0.1:3128/%{ENV:BACKEND_LOCATION}/%{ENV:BACKEND_PORT}/https/%{SERVER_NAME}/80/%{ENV:BACKEND_PATH}/__original_url__/$1 [L,P]\n RewriteRule ^/(.*)$ http://127.0.0.1:3128/%{ENV:BACKEND_LOCATION}/%{ENV:BACKEND_PORT}/https/%{SERVER_NAME}/80/%{ENV:BACKEND_PATH}/__original_url__/$1 [L,P]\n ...\n\nNow test a 2.6 config::\n\n >>> options['squid_version'] = '2.6'\n >>> buildout = {'instance': {'location': test_dir},\n ... 'buildout': {'directory': test_dir,\n ... 'parts-directory': test_dir}}\n >>> name = 'squid'\n >>> recipe = Recipe(buildout, name, options)\n >>> recipe.options['squid_version']\n '2.6'\n >>> paths = recipe.install()\n >>> cfg = os.path.join(path, 'etc', 'squid.conf')\n\n\n\nTest if redirector is threaded::\n\n >>> cfg = os.path.join(path, 'etc', 'iRedirector.py')\n >>> print open(cfg).read()\n #!...\n threaded = 1...\n\n >>> cfg = os.path.join(path, 'etc', 'squidAcl.py')\n >>> print open(cfg).read()\n #!...\n debug = 0...\n logfile = ...squid/log...\n\nChange default location of installation::\n\n >>> options = {'url': 'mypackage.tgz', #url where we download squid src\n ... 'squid_owner': owner, #owner of squid process\n ... 'squid_group' : group, #group of squid process\n ... 'squid_port' : '3128', #listen port of proxy\n ... 'squid_version' : '2.5',\n ... 'squid_localisation': '127.0.0.1', #host or ip that apache use to request apache\n ... 'squid_log_dir' : '/var/log/dir',\n ... 'squid_config_dir' : '/usr/local/squid/etc',\n ... 'apache_conf_dir' : '/etc/apache2/conf',\n ... 'squid_admin_email' : 'myemail@mycompany.com', #name appear in error message\n ... 'squid_cache_size_mb' : '1000', #total cache in disk\n ... 'squid_visible_hostname' : 'mysite', #public name of your site, appear in error message\n ... 'front_https': '1', # does front server (apache, iis)\n ... # serve https url O by default\n ... 'front_http':'1', # does front server (apache, iis) serve http url\n ... 'debug_redirector':'1', #debug iRedirector 0 by default\n ... 'debug_squid_acl' : '0', #debug squidacl 0 by default\n ... 'debug_squid_rewrite_rules' : '1', #debug squidtrewriterule 0 by default\n ...\n ... }\n\n >>> from iw.recipe.squid import Recipe\n\n >>> options['squid_accelerated_hosts'] = \"\"\"\n ... www.mysite.com: 127.0.0.1:8080/mysite\n ... mysite.com: 127.0.0.1:8080/mysite\n ... www.mysecondsite.com: 127.0.0.2:9080/mysite2\n ... mysecondsite.com: 127.0.0.2:9080/mysite2\n ... \"\"\"\n\n >>> recipe = Recipe(buildout, name, options)\n >>> recipe.options['apache_conf_dir']\n '/etc/apache2/conf'\n >>> recipe.options['squid_config_dir']\n '/usr/local/squid/etc'", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://plone.org/products/iw-recipes", "keywords": "squid for zope", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "iw.recipe.squid", "package_url": "https://pypi.org/project/iw.recipe.squid/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/iw.recipe.squid/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://plone.org/products/iw-recipes" }, "release_url": "https://pypi.org/project/iw.recipe.squid/1.0/", "requires_dist": null, "requires_python": null, "summary": "ZC buildout recipe to configure an squid proxy for zope", "version": "1.0" }, "last_serial": 755388, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "c0e4c057983a57a9f185dfdcd6ad5d12", "sha256": "c60cf609ba3c7d80596821c59c143457d1c79db79931201ad90b7dedde385fb8" }, "downloads": -1, "filename": "iw.recipe.squid-0.2-py2.4.egg", "has_sig": false, "md5_digest": "c0e4c057983a57a9f185dfdcd6ad5d12", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 45314, "upload_time": "2007-12-12T14:43:33", "url": "https://files.pythonhosted.org/packages/63/aa/67642d02ebd87dd61b935d026e1ac680088cb7994d13bf39fdbeddb32359/iw.recipe.squid-0.2-py2.4.egg" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "2c7aa3247b67ca0de1933dc702d486a9", "sha256": "55c7e6e9ffec2c14ae9c7f6aa236b90c42626d5139371b766703731036767bbf" }, "downloads": -1, "filename": "iw.recipe.squid-0.3-py2.4.egg", "has_sig": false, "md5_digest": "2c7aa3247b67ca0de1933dc702d486a9", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 46071, "upload_time": "2008-02-26T10:57:26", "url": "https://files.pythonhosted.org/packages/0a/d7/579d71ac7c860749f59c5c0e717ca7f8a812b8f77ba8d5c75e548a0f40e3/iw.recipe.squid-0.3-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "32a342fead137b223c2c9ec6ad5ce2d3", "sha256": "eb1eb6c81e6fae2ec0acbf55e9e65f343b2827c6a06f520fb3ac9ce8ba087e93" }, "downloads": -1, "filename": "iw.recipe.squid-0.3.tar.gz", "has_sig": false, "md5_digest": "32a342fead137b223c2c9ec6ad5ce2d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25668, "upload_time": "2008-02-26T10:57:25", "url": "https://files.pythonhosted.org/packages/9f/bf/838b52ccb74436faf4ad8200eed821111ac564abe022b30ab2458416dc8b/iw.recipe.squid-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "f1508995a0bb32e7a84e86b8ee3b861e", "sha256": "9cd21463a5f1fc022fc016c3602dbdd6a4652f0c049a518970ebc0e4027776ac" }, "downloads": -1, "filename": "iw.recipe.squid-0.4-py2.4.egg", "has_sig": false, "md5_digest": "f1508995a0bb32e7a84e86b8ee3b861e", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 46727, "upload_time": "2008-07-02T15:12:50", "url": "https://files.pythonhosted.org/packages/4a/61/67ff29583902c421321906796a8a6b8e2bd16f263e21d807d3fd9edd2052/iw.recipe.squid-0.4-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "88f73c5a0769d21f196436986c7e90de", "sha256": "a99c63cff03f7195f031e4842940728805d9f9a9fe476a3a81baf9d5a939fc37" }, "downloads": -1, "filename": "iw.recipe.squid-0.4.tar.gz", "has_sig": false, "md5_digest": "88f73c5a0769d21f196436986c7e90de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32038, "upload_time": "2008-07-02T15:12:48", "url": "https://files.pythonhosted.org/packages/81/40/85f7a33160d0c8f5cfe7afea0b19450fe88d66949482a93d3e7da51015f9/iw.recipe.squid-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "ffd5113ad921a83a7dcd7a7b9a3f3cdb", "sha256": "498ba81b0264a3a44bb1d14f32c547c09e30b1c3918b6b49a6a7689a1b0d90ab" }, "downloads": -1, "filename": "iw.recipe.squid-0.5-py2.4.egg", "has_sig": false, "md5_digest": "ffd5113ad921a83a7dcd7a7b9a3f3cdb", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 47139, "upload_time": "2008-08-25T09:28:37", "url": "https://files.pythonhosted.org/packages/be/41/d61fe291bbff8c678a156ee2182652b0352b4838999084dffbb2be0b1a46/iw.recipe.squid-0.5-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "85cd7c78ef4dd20e74ef0b37dc4b5082", "sha256": "917156eb28ed72a373a417b2ace5c8677a5170bc47a95741fc95e22e1cee4ec4" }, "downloads": -1, "filename": "iw.recipe.squid-0.5.tar.gz", "has_sig": false, "md5_digest": "85cd7c78ef4dd20e74ef0b37dc4b5082", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32541, "upload_time": "2008-08-25T09:28:34", "url": "https://files.pythonhosted.org/packages/68/05/e4465f100ae4425a6d51ed21506e4b5055e25518cbe2cd4c178d009a6933/iw.recipe.squid-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "782dd20cb97b5aac4aa9c047b9a47653", "sha256": "5fc3dacbbd1d84813a659030dc751ec0b4209b4965f4d1a814715889e157fa87" }, "downloads": -1, "filename": "iw.recipe.squid-0.6-py2.4.egg", "has_sig": false, "md5_digest": "782dd20cb97b5aac4aa9c047b9a47653", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 47269, "upload_time": "2008-09-01T11:58:17", "url": "https://files.pythonhosted.org/packages/97/0c/ab64601bb78821be0ecfbbbd04595a9708fce8635bd753e91ee203d0e63b/iw.recipe.squid-0.6-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "b76a7448c5000653e28eb6d086eb9856", "sha256": "382d0af25fcac1d0cb856be31330f195bc6d532afe395ec914b562f15694fe37" }, "downloads": -1, "filename": "iw.recipe.squid-0.6.tar.gz", "has_sig": false, "md5_digest": "b76a7448c5000653e28eb6d086eb9856", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32703, "upload_time": "2008-09-01T11:58:15", "url": "https://files.pythonhosted.org/packages/59/1d/ce9415ce4022e032d8faf45f1b6df261cbe1502800a58bb2659dacb8bacd/iw.recipe.squid-0.6.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "4f4e3614d5e89db6fb85a9b1b81c0558", "sha256": "f1a57f2aed3b63598d55b3842cd211cdc3f4671cfffdaa7b6ae4e44fc6a53a53" }, "downloads": -1, "filename": "iw.recipe.squid-0.7-py2.4.egg", "has_sig": false, "md5_digest": "4f4e3614d5e89db6fb85a9b1b81c0558", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 47340, "upload_time": "2008-11-14T21:22:22", "url": "https://files.pythonhosted.org/packages/74/66/8615cdf30f7644e4a247873cf7dff982f25a9772cf79b92eaddb51434c12/iw.recipe.squid-0.7-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "9fa180486a82bd7bad2b1bc015e35af0", "sha256": "e5db474f4711db2aa0e949988f4625f06f1e1a583fc8f0bacd1d50f7e90ccaf8" }, "downloads": -1, "filename": "iw.recipe.squid-0.7.tar.gz", "has_sig": false, "md5_digest": "9fa180486a82bd7bad2b1bc015e35af0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32859, "upload_time": "2008-11-14T21:22:20", "url": "https://files.pythonhosted.org/packages/16/79/5d7afa95fe6f89d6d6fa3b9d6a7f5feae07b566962f1fc735eb161762606/iw.recipe.squid-0.7.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "221957ac32e798a712a672d2c2c1223c", "sha256": "bb8c092fc6780ebd39a4cb4d5fe939fb796a11a1e8d2753161c2f78aaea5a6d6" }, "downloads": -1, "filename": "iw.recipe.squid-0.8.tar.gz", "has_sig": false, "md5_digest": "221957ac32e798a712a672d2c2c1223c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33623, "upload_time": "2008-11-18T14:33:47", "url": "https://files.pythonhosted.org/packages/06/1e/19b8508a613a5c511aec0477f0e0a28c487cc66182a8c63e106664aab47a/iw.recipe.squid-0.8.tar.gz" } ], "0.9": [ { "comment_text": "", "digests": { "md5": "0d274583761f66c9dfbc725d4ff5f71f", "sha256": "b4342e7d7fd1964b6d6943b1ada4f0f6830503c423e04ac8dbf92ce818a5d125" }, "downloads": -1, "filename": "iw.recipe.squid-0.9-py2.4.egg", "has_sig": false, "md5_digest": "0d274583761f66c9dfbc725d4ff5f71f", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 42697, "upload_time": "2008-11-20T11:42:02", "url": "https://files.pythonhosted.org/packages/f2/0a/40002415b38a64f9feebf9fc2469136b95865c7b19354c9cfc37fa8e0b92/iw.recipe.squid-0.9-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "14bf60b3094d3bb90e2417b54cd0c3bd", "sha256": "386b0ea1bafa7d2b8a7227b9c6c6b5908b47841de08b9f2656d8dc2e4d904ad9" }, "downloads": -1, "filename": "iw.recipe.squid-0.9.tar.gz", "has_sig": false, "md5_digest": "14bf60b3094d3bb90e2417b54cd0c3bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34387, "upload_time": "2008-11-20T11:42:00", "url": "https://files.pythonhosted.org/packages/ea/7a/9f8c5694a97c4dd33f9a0a396487ce80ca97627d06fe174f0b62a7d2cd35/iw.recipe.squid-0.9.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "cf70d5892c003224cd8621b827db0973", "sha256": "3935b3066b862fd06de5fc9eb7da4a8827b367ec5387dacfd1704d463cb030a6" }, "downloads": -1, "filename": "iw.recipe.squid-1.0.tar.gz", "has_sig": false, "md5_digest": "cf70d5892c003224cd8621b827db0973", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37240, "upload_time": "2010-02-26T11:46:05", "url": "https://files.pythonhosted.org/packages/8a/29/849e2f5046af383eabca18d25de245a9f2710d289e94fd4851d3a7bd568a/iw.recipe.squid-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cf70d5892c003224cd8621b827db0973", "sha256": "3935b3066b862fd06de5fc9eb7da4a8827b367ec5387dacfd1704d463cb030a6" }, "downloads": -1, "filename": "iw.recipe.squid-1.0.tar.gz", "has_sig": false, "md5_digest": "cf70d5892c003224cd8621b827db0973", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37240, "upload_time": "2010-02-26T11:46:05", "url": "https://files.pythonhosted.org/packages/8a/29/849e2f5046af383eabca18d25de245a9f2710d289e94fd4851d3a7bd568a/iw.recipe.squid-1.0.tar.gz" } ] }