개발자 참고자료
리다이렉트 체인 API 문서
리다이렉트 체인 API 문서: URL 리다이렉트 체인을 따라가 HTTPS 업그레이드, 도메인 변경, 최종 방문 페이지를 감지합니다. SEO 분석, 보안 감사, URL 라우팅 이해에 유용합니다. 301, 302, 303, 307, 308을 포함한 모든 3xx 리다이렉트를 추적합니다.
리다이렉트 체인
URL 리다이렉트 체인을 따라가 HTTPS 업그레이드, 도메인 변경, 최종 방문 페이지를 감지합니다. SEO 분석, 보안 감사, URL 라우팅 이해에 유용합니다. 301, 302, 303, 307, 308을 포함한 모든 3xx 리다이렉트를 추적합니다.
GET
/v1/redirects
쿼리 매개변수
| 매개변수 | 유형 | 설명 |
|---|---|---|
| url 필수 | string | 따라갈 시작 URL(예: "http://example.com") |
| max_redirects 선택 사항 | number | 따라갈 최대 리다이렉트(기본값: 10, 최대: 20) |
응답 필드
| 필드 | 유형 | 설명 |
|---|---|---|
original_url | string | 제공된 시작 URL |
final_url | string | 모든 리다이렉트 이후의 최종 URL |
redirect_count | number | 따라간 총 리다이렉트 수 |
https_upgrade | boolean | HTTP가 HTTPS로 업그레이드되었는지 여부 |
chain | array | URL, 상태 코드, 위치를 포함한 각 리다이렉트 |
예제 요청
curl "https://domscan.net/v1/redirects?url=http://github.com"
const response = await fetch(
"https://domscan.net/v1/redirects?url=" + encodeURIComponent("http://github.com")
);
const data = await response.json();
console.log(`Final URL: ${data.final_url}`);
console.log(`Redirects: ${data.redirect_count}`);
console.log(`HTTPS upgrade: ${data.https_upgrade}`);
data.chain.forEach((hop, i) => {
console.log(`${i + 1}. ${hop.status} ${hop.url} → ${hop.location}`);
});
import requests
from urllib.parse import quote
url = quote("http://github.com", safe='')
response = requests.get(f"https://domscan.net/v1/redirects?url={url}")
data = response.json()
print(f"Final URL: {data['final_url']}")
print(f"HTTPS upgrade: {data['https_upgrade']}")
for i, hop in enumerate(data['chain']):
print(f"{i+1}. [{hop['status']}] {hop['url']}")
예제 응답
{
"original_url": "http://github.com",
"final_url": "https://github.com/",
"redirect_count": 1,
"chain": [
{
"url": "http://github.com",
"status": 301,
"location": "https://github.com/",
"response_time_ms": 45
}
],
"https_upgrade": true,
"domain_change": false,
"total_time_ms": 156
}