πŸ–₯️ Computer Science/Web

[HTTP 헀더] X-Forwarded-for 와 X-Forwarded-Proto

Rosieblue 2023. 2. 22. 21:33
728x90

μ›Ήν•΄ν‚Ήμ—μ„œλ„, NGINX 곡뢀할 λ•Œλ„ 두 헀더가 μ’…μ’… λ“±μž₯ν•΄ 정리해 보고자 ν•œλ‹€.

 

μ™œ X-Fowarded-for 헀더와 X-Forwarded-Protoλ₯Ό μ“ΈκΉŒ?

κ°„λ‹¨νžˆ λ§ν•΄μ„œ 두 ν—€λ”λŠ” μ„œλ²„λ‘œ μ ‘κ·Όν•œ μ• λ“€μ˜ ip와 ν”„λ‘œν† μ½œμ„ μ•Œλ €μ£ΌλŠ” 헀더이닀.

그런데 μ„œλ²„ λ‘œκ·Έμ—λ„ λΆ„λͺ… λˆ„κ°€ μ–΄λ–»κ²Œ μ ‘κ·Όν–ˆλŠ”μ§€ λ‚˜μ˜¬ν…λ° ꡳ이 λ”°λ‘œ 헀더λ₯Ό λ§Œλ“€μ–΄ λͺ…μ‹œν•΄μ£ΌλŠ” μ΄μœ λŠ” 뭘까?

 

κ·Έ μ΄μœ λŠ” λ§Œμ•½ ν΄λΌμ΄μ–ΈνŠΈκ°€ ν”„λ‘μ‹œλ‚˜ λ‘œλ“œ λ°ΈλŸ°μ„œ 등을 톡해 μ„œλ²„μ— μ ‘κ·Όν•œλ‹€λ©΄ μ„œλ²„λŠ” ν΄λΌμ΄μ–ΈνŠΈκ°€ μ•„λ‹Œ ν”„λ‘μ‹œλ‚˜ λ‘œλ“œ λ°ΈλŸ°μ„œμ˜ 정보λ₯Ό κΈ°λ‘ν•˜κΈ° λ•Œλ¬Έμ΄λ‹€.

 

 

λ‹€μ‹œ 말해 두 ν—€λ”λŠ” λ‘œλ“œλ°ΈλŸ°μ„œ ν˜Ήμ€ ν”„λ‘μ‹œμ— μ ‘κ·Όν•œ ν΄λΌμ΄μ–ΈνŠΈμ˜ IPμ£Όμ†Œ(X-Forwarded-For)와 ν”„λ‘œν† μ½œ(X-Forwarded-Proto)을 λ‚˜νƒ€λ‚Έλ‹€.

 

 

Syntex

X-Forwarded-For: <client>, <proxy1>, <proxy2>
X-Forwarded-Proto: <protocol> #ex: HTTP,HTTPS

 

 

 

 

References

https://developer.mozilla.org/ko/docs/Web/HTTP/Headers/X-Forwarded-Proto

 

X-Forwarded-Proto - HTTP | MDN

X-Forwarded-Proto (XFP) ν—€λ”λŠ” ν΄λΌμ΄μ–ΈνŠΈκ°€ λ‹Ήμ‹ μ˜ ν”„λ‘μ‹œ λ˜λŠ” λ‘œλ“œ λ°ΈλŸ°μ„œμ— μ ‘μ†ν•˜λŠ”λ°μ— μ‚¬μš©ν–ˆλ˜ ν”„λ‘œν† μ½œ(HTTP λ˜λŠ” HTTPS)이 무엇인지 ν™•μΈν•˜λŠ” μ‚¬μ‹€μƒμ˜ ν‘œμ€€ 헀더 μž…λ‹ˆλ‹€. λ‹Ήμ‹ μ˜ μ„œλ²„ μ ‘κ·Ό

developer.mozilla.org

https://nurilee.com/2020/05/14/x-forwarded-for%EC%99%80-x-forwarded-proto-%EB%9E%80/

 

X-Forwarded-For와 X-Forwarded-Proto λž€

X-Forwarded-For (XFF) ν—€λ”λž€ HTTP ν”„λ‘μ‹œ λ˜λŠ” λ‘œλ“œ λ°ΈλŸ°μ„œλ₯Ό ν†΅ν•΄μ„œ μ›Ήμ„œλ²„μ— μ—°κ²°ν•˜λŠ” ν΄λΌμ΄μ–ΈνŠΈμ˜ μ›λž˜ IP μ£Όμ†Œλ₯Ό μ‹λ³„ν•˜κΈ° μœ„ν•œ ν‘œμ€€ ν—€λ”μž…λ‹ˆλ‹€. νŠΈλž˜ν”½μ΄ ν΄λΌμ΄μ–ΈνŠΈμ™€ μ„œλ²„ 사이 쀑간에 프둝

nurilee.com