Order Is Important!
- Order is important
- Order is critical
This is by far the No. 1 most repeated comment in the Squid user help lists. Squid with its traditional "Bungled config line" is not exactly helpful either when it comes to notifying what the problem is.
Squid process its config file from the top down. Left to right. Creating internal configuration information as it goes.
To create a metaphor there is a simple everyday procedure one performs to enter a locked door. Unlock, open, and walk through. Get them out of order. For example "unlock, walk, open" is possibly valid. But will result in some pain when actually done that way and will not result in the opener being on the far side of the doorway.
Similarly there are groups of actions which are individually configured in squid.conf. But the order determines what the final situation is.
Modern Squid run multiple modes of operation simultaneously.
The order of http_access forward-proxy and reverse-proxy configuration options determines whether a reverse-proxy website visitor is able to reach the website. They also determine whether that website is able to perform HTTPS, AJAX, JSON, or other advanced website operations beyond plain simple HTTP. see the relevant SquidFaq/ReverseProxy#How_do_I_set_it_up.3F example for specific order details. Generally the reverse-proxy needs to be first.
The order and placement of debug_options directives determines what debug levels are run during processing of the configuration file and later during normal running of Squid.
The order of auth_param program directives determines how Squid reports the authentication options to Browsers. This has visible effects on what type of authentication is performed. see Features/Authentication for details and recommended ordering.
external_acl_type using %LOGIN will trigger authentication challenges if those credentials are not present. The placement of these tests affects which rules around them require authentication.
Similarly acl testing authentication placement left-to-right on their line determins whether the test bypasses, fails or triggers an auth challenges.
acl definition lines must be specified before any point at which they are mentioned for use.
This goes for each type of access directive. see SquidFaq/SquidAcl#Access_Lists for a list of access types.
The order of individual words on each access control line is even more critical. This can mean the difference between having an access control line match or skip. Or whether Squid can process 300 or 3 thousand requests per second. see SquidFaq/SquidAcl#Common_Mistakes for details on how ordering of individual line words works.
Some others have a simpler interaction, but ordering is still important.
- refresh_pattern - top down first pattern match wins.
- delay_pools + delay_class + delay_parameters - must be added in that order: pools, class, parameters.
- cache_peer - order of individual cache_peer entries affects selection of default and first-available peer.