« Haproxy : Les ACLs » : différence entre les versions
De www.yakakliker.org
(Page créée avec « {| class="wikitable" | colspan="1" rowspan="1" |ACL | colspan="1" rowspan="1" |<small>Description</small> |- | colspan="1" rowspan="1" |<code>if { path_beg /api/ }</code> | colspan="1" rowspan="1" |<small>Route API requests.</small> |- | colspan="1" rowspan="1" |<code>if { path_end .jpg .png }</code> | colspan="1" rowspan="1" |<small>Route requests for images.</small> |- | colspan="1" rowspan="1" |<code>if { hdr(host) -m dom example.local }</code> | colspan="1" r... ») |
Aucun résumé des modifications |
||
(2 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 1 : | Ligne 1 : | ||
{| class="wikitable" | {| class="wikitable" | ||
| colspan="1" rowspan="1" |ACL | | colspan="1" rowspan="1" |'''ACL''' | ||
| colspan="1" rowspan="1" |<small>Description</small> | | colspan="1" rowspan="1" |<small>'''Description'''</small> | ||
|- | |- | ||
| colspan="1" rowspan="1" |<code>if { path_beg /api/ }</code> | | colspan="1" rowspan="1" |<code>if { path_beg /api/ }</code> | ||
Ligne 21 : | Ligne 21 : | ||
| colspan="1" rowspan="1" |<small>Route requests that have a URL parameter named ''region'' that is set to ''europe''.</small> | | colspan="1" rowspan="1" |<small>Route requests that have a URL parameter named ''region'' that is set to ''europe''.</small> | ||
|} | |} | ||
=== Syntaxe basique === | |||
<syntaxhighlight lang="bash"> | |||
frontend www | |||
bind :80 | |||
acl images_url path -i -m beg /images/ | |||
</syntaxhighlight> | |||
'''In this example:''' | |||
* The name assigned to the ACL is <code>images_url</code>. | |||
* The <code>path</code> argument returns the URL path that the client requested. Function like <code>path</code> are called ''fetch methods''. | |||
* The <code>-i</code> flag performs a case-insensitive match of the requested URL path. | |||
* The <code>-m beg</code> flag means that the ''match type'' is ''begins with''. | |||
* Note that an ACL on its own performs no action. Later, you will see how to pair it with an action. | |||
Ligne 30 : | Ligne 43 : | ||
[[Catégorie:Haproxy]] | [[Catégorie:Haproxy]] | ||
[[Catégorie:Reverse Proxy]] | [[Catégorie:Reverse Proxy]] | ||
<html> | |||
<a href="https://www.compteurdevisite.com" title="compteur web gratuit sans pub"><img src="https://counter6.optistats.ovh/private/compteurdevisite.php?c=b4epghealnwlf7wuq7gn3ygll9aywrfx" border="0" title="compteur web gratuit sans pub" alt="compteur web gratuit sans pub"></a> | |||
</html> | |||
<html> | |||
<script src='https://storage.ko-fi.com/cdn/scripts/overlay-widget.js'></script> | |||
<script> | |||
kofiWidgetOverlay.draw('yakakliker', { | |||
'type': 'floating-chat', | |||
'floating-chat.donateButton.text': 'Café', | |||
'floating-chat.donateButton.background-color': '#00b9fe', | |||
'floating-chat.donateButton.text-color': '#fff' | |||
}); | |||
</script> | |||
</html> |
Dernière version du 28 août 2025 à 11:24
ACL | Description |
if { path_beg /api/ }
|
Route API requests. |
if { path_end .jpg .png }
|
Route requests for images. |
if { hdr(host) -m dom example.local }
|
Routes requests for the domain example.local. |
if { src 127.0.0.1/8 }
|
Route requests originating from the given IP address range. |
if { method POST PUT }
|
Route POST and PUT requests. |
if { url_param(region) europe }
|
Route requests that have a URL parameter named region that is set to europe. |
Syntaxe basique
frontend www
bind :80
acl images_url path -i -m beg /images/
In this example:
- The name assigned to the ACL is
images_url
. - The
path
argument returns the URL path that the client requested. Function likepath
are called fetch methods. - The
-i
flag performs a case-insensitive match of the requested URL path. - The
-m beg
flag means that the match type is begins with. - Note that an ACL on its own performs no action. Later, you will see how to pair it with an action.
Liens
https://www.haproxy.com/blog/introduction-to-haproxy-acls