[squid-users] Howto make Squid config dependent on hostname?
Hildegard Meier
daku8938 at gmx.de
Fri Sep 16 10:30:33 UTC 2022
> Squid currently only supports three kinds of conditions: true,
> false, and integer equality comparison (as documented).
I think it would be very good to give some concrete examples of how one can use the if-condition. The current abstract and vague "documentation" is totally unclear to me.
> For now, your best option is probably to post-process the versioned
> configuration to substitute your own custom macro(s). For example, your
> Squid startup (or deployment) stript can substitute a
> ${mynamespace:PeerName} macro in squid.conf.template with either true or
> false, depending on the node, producing squid.conf that Squid can use:
>
> cache_peer ${mynamespace:PeerName} sibling 3128 3130
>
>
> If you need to hard-code peer names or substantially different
> configurations for individual cache peers, then you can do something
> like this in the template configuration file:
>
> if ${mynamespace:AtNode1()}
> cache_peer node2.example.com sibling 3128 3130
> endif
>
> if ${mynamespace:AtNode2()}
> cache_peer node1.example.com sibling 3128 3130
> endif
>
Sorry, I do not understand what you write.
More information about the squid-users
mailing list