..:: AsmBB ::..: Real user IP address behind cloudflare/proxy
<img src="https://board.asm32.info/images/title.svg" alt="Title img">
<h1>AsmBB is ultrafast web forum, written entirely in assembly language. This site is the official support development forum and demo/test installation.</h1>
tag:board.asm32.info,2018-03-06:Thread3032020-03-12T15:58:03Zjohnfound on Real user IP address behind cloudflare/proxytag:board.asm32.info,2018-03-06:Post160342020-03-12T15:58:03Z
<blockquote><header>ganuonglachanh</header><p>Can we temporary fix ?
</p>
<pre><code class="">
;
; Attempts to retrive the most probable remote IP address of the user.
;
; right now, it uses very simple logic, but will be improved soon in
; order to properly manage the proxy servers and cloudflare forward
; mechanisms.
;
proc GetRemoteIP, .pSpecial
begin
mov eax, [.pSpecial]
stdcall ValueByName, [eax+TSpecialParams.params], "CF-Connecting-IP"
jnc .ip2num
stdcall ValueByName, [eax+TSpecialParams.params], "REMOTE_ADDR"
jc .error
.ip2num:
stdcall StrIP2Num, eax
jnc .finish
.error:
xor eax, eax
.finish:
return
endp
</code></pre></blockquote>
<p>Sure! I simply wanted to have it to support different proxies as well. But for you is OK as temporary solution.
</p>
johnfoundganuonglachanh on Real user IP address behind cloudflare/proxytag:board.asm32.info,2018-03-06:Post160332020-03-12T15:43:43Z
<p>Can we temporary fix ?
</p>
<pre><code class="">
;
; Attempts to retrive the most probable remote IP address of the user.
;
; right now, it uses very simple logic, but will be improved soon in
; order to properly manage the proxy servers and cloudflare forward
; mechanisms.
;
proc GetRemoteIP, .pSpecial
begin
mov eax, [.pSpecial]
stdcall ValueByName, [eax+TSpecialParams.params], "CF-Connecting-IP"
jnc .ip2num
stdcall ValueByName, [eax+TSpecialParams.params], "REMOTE_ADDR"
jc .error
.ip2num:
stdcall StrIP2Num, eax
jnc .finish
.error:
xor eax, eax
.finish:
return
endp
</code></pre>
ganuonglachanh johnfound on Real user IP address behind cloudflare/proxytag:board.asm32.info,2018-03-06:Post160242020-03-12T11:50:50Z
<p>That is something new for me. Will try to study the problem and fix it.</p>
johnfoundganuonglachanh on Real user IP address behind cloudflare/proxytag:board.asm32.info,2018-03-06:Post160192020-03-12T07:46:26Z
<p>Hi johnfound
</p>
<p>I'm using cloudflare so real user IP is hidden, asmbb only get cloudflare IP via <strong>REMOTE_ADDR</strong> header:
</p>
<pre><code class="">stdcall ValueByName, [edi+TSpecialParams.params], "REMOTE_ADDR"
</code></pre>
<p>Could you add support for getting the real IP address if these headers are found: via "CF-Connecting-IP" (only apply for cloudflare) or "X-Forwarded-For" (apply for non anonymous proxies but has 1 or multiple IPs)
</p>
<p>More info here:
</p>
<p><a href="https://support.cloudflare.com/hc/en-us/articles/200170986-How-does-CloudFlare-handle-HTTP-Request-headers-">https://support.cloudflare.com/hc/en-us/articles/200170986-How-does-CloudFlare-handle-HTTP-Request-headers-</a> </p>
ganuonglachanh