GrepBoard/매뉴얼
605 편 ·

AH00124 limit of 10 internal redirects

·시험 환경 Apache httpd 2.4.69 (Docker) · 2026-10·시험 범위 ↓·5 단계

AH00124 exceeded the limit of 10 internal redirects 는 .htaccess 재작성 규칙이 자기 출력에 다시 걸리는 루프입니다. 조건을 붙여 해결합니다.

페이지는 500 으로 열리고 error_log 에는 이 줄이 남습니다. 앞의 시각·pid 는 … 로 줄였습니다.

output
… [core:error] … [client 203.0.113.5:39490] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

AH00124: Request exceeded the limit of 10 internal redirects 는 요청 하나가 내부적으로 열 번 넘게 다시 처리되어 httpd 가 무한 반복으로 보고 끊었다는 뜻입니다. 서버가 느린 것도, 한도가 낮은 것도 아니고 설정이 같은 자리를 맴도는 것이므로, 한도를 올리지 말고 반복을 만드는 재작성 규칙(.htaccess 의 RewriteRule 등)에 조건을 붙여 자기 출력에 다시 걸리지 않게 합니다. 아래는 그 규칙을 찾는 순서입니다. 접속 로그에는 GET /app/x HTTP/1.1" 500 으로 남았습니다.

[1] 로그 레벨을 올려 반복되는 URL 을 봅니다. 줄이 알려 주는 대로 LogLevel debug 로 바꾸고 설정을 다시 읽힌 뒤 같은 주소를 한 번 요청합니다. debug 는 줄이 매우 많으므로 확인하면 바로 warn 으로 되돌립니다. 운영 서버라면 전체 대신 모듈만 올리는 LogLevel warn core:debug 가 로그 폭증을 줄입니다(공식 문서의 모듈별 LogLevel. 아래 backtrace 줄이 core:debug 이므로 나올 것으로 보지만, 이 조합은 직접 시험하지 않았고 시험은 전체 debug 로 했습니다).

/etc/apache2/apache2.conf
LogLevel debug

[2] 오류 줄 바로 뒤에 붙는 AH00121·AH00122 줄이 backtrace 입니다. 처음 요청 /app/x 가 어떻게 바뀌어 갔는지 거꾸로 적혀 있습니다.

output
… [core:debug] … AH00121: r->uri = /app/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/x… [core:debug] … AH00122: redirected from r->uri = /app/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/x… [core:debug] … AH00122: redirected from r->uri = /app/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/x…… [core:debug] … AH00122: redirected from r->uri = /app/index.php/x… [core:debug] … AH00122: redirected from r->uri = /app/x

한 번 돌 때마다 /index.php 가 하나씩 앞에 붙습니다. 규칙이 자기가 만든 URL 에 다시 걸리고 있다는 증거입니다. 이 시험은 이렇게 주소가 커지는 모양만 재현했습니다.

[3] 반복의 출발점이 되는 규칙을 찾습니다. 이 시험의 원인은 해당 디렉터리의 .htaccess 에 조건 없는 규칙이 있는 것이었습니다.

run/htaccess-bad.conf
RewriteEngine OnRewriteRule ^(.*)$ /app/index.php/$1

^(.*)$ 는 모든 경로에 맞고, 결과인 /app/index.php/x 도 같은 디렉터리 안이라 다시 이 규칙에 맞습니다. 파일이 이미 있으면 건너뛰도록 조건을 붙이고, 대상 주소를 고정합니다.

run/htaccess-fixed.conf
RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /app/index.php [L]

주의: 원래 규칙은 경로를 /app/index.php/$1(PATH_INFO)로 넘겼지만 고친 규칙은 경로를 넘기지 않습니다. 앱이 PATH_INFO 로 라우팅한다면 모든 주소가 첫 화면으로 갈 수 있습니다. 이 시험은 PHP 없이 index.php 를 정적 파일로 받아 「front controller」 문자열만 확인했으므로 라우팅이 유지되는지는 검증하지 않았습니다. 앱이 어느 값을 읽는지 먼저 확인하고, $1 을 남긴 변형은 점검 환경에서 따로 시험합니다.

[4] 고친 뒤 확인합니다. 없는 주소는 index.php 로 가고, 실제 파일은 그대로 열리며, AH00124 줄은 새로 생기지 않았습니다.

output
front controller <- /app/x HTTP 200static file <- /app/real.txt HTTP 200front controller <- /app/a/b/c HTTP 200

[5] 한도를 올리는 것은 해결이 아닙니다. 같은 설정에서 LimitInternalRecursion 100 을 주면 한도만 바뀌고 오류는 그대로 납니다.

output
… [core:error] … AH00124: Request exceeded the limit of 100 internal redirects due to probable configuration error. …

공식 문서는 이 지시어를 서버 설정과 가상 호스트 문맥에서만 쓸 수 있다고 하고, 반복을 막기 위한 안전장치로 설명합니다. 정상적으로 길게 이어지는 체인이 있을 때만 올립니다.

403 이 나는 경우는 AH01630 해결을 봅니다.

Apache 로그를 브라우저에서 바로 분석 ↗ — 아무것도 올라가지 않습니다.

#apache#httpd#mod_rewrite#htaccess#ah00124