Haproxy

haproxy 자주 쓰는 핵심 문법 3가지

babbeolicoding 2026. 1. 14. 21:35
반응형

1. http-request replace-path

- 용도
들어오는 요청의 경로(URL)를 치환할 때 사용

- 사용방법
http-request replace-path <정규식> <치환 문자열>

- ex)
http-request replace-path ^/test/file/?(.*)$ /replace/test/file/\1
  => /test/file/test.txt → /replace/test/file/test.txt

 

2.path_beg

- 용도
 요청 경로가 특정 문자열로 시작하는지 체크

- 사용방법
 acl <이름> path_beg /경로

- ex)
  acl file path_beg /test/file

 

3. hdr(host) -i

- 용도
 요청 Host 헤더를 검사할 때 사용(-i : 대소문자 구분 없이 비교)

- 사용방법
 acl <이름> hdr(host) -i <도메인>

- ex)
 acl is_test hdr(host) -i test.file.com
반응형