#general

Adjusting IP Settings in Chatwoot with Cloudflare and Docker

TLDR eddippla wanted to adjust IP settings to reflect the visitor's actual IP when using Cloudflare and Docker with Chatwoot. sojan_official and rinndoge suggested customizing the code to read from headers and offered several workarounds. The discussion also moved onto the topic of Cloudflare's business model and hosting efficiency.

Powered by Struct AI
69
5mo
Solved
Join the chat
Jun 14, 2023 (5 months ago)
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
04:54 PM
Hey guys, is it possible to adjust the IP setting so that the logged IP address on the user contact reflects the visitor's actual IP? Right now, I'm using Cloudflare, which assigns its own IP address. However, I need to obtain the real IP address of the visitor. Is it feasible to make this change?
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
05:09 PM
If I am running with docker, how can I edit the code? Would I need to create a custom image?
05:58
eddippla
05:58 PM
so guys the real ip is in the "X-Forwarded-For" header for me so would this code below work
05:58
eddippla
05:58 PM
ruby
      { created_at_ip: request.headers["X-Forwarded-For"] or request.remote_ip }
rinndoge
Photo of md5-ba6f113b7f3c6d6a6e849f8d5fed05bb
rinndoge
07:48 PM
CF-Connecting-IP would also work
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
07:48 PM
true
07:48
eddippla
07:48 PM
i just havent connected it to the nginx config yet
07:48
eddippla
07:48 PM
cause im proxying from cloudflare to nginx to chatwoot
rinndoge
Photo of md5-ba6f113b7f3c6d6a6e849f8d5fed05bb
rinndoge
07:48 PM
Moved away from them yesterday while testing them 😄
07:49
rinndoge
07:49 PM
They can't handle any DDos leakage
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
07:49 PM
oh what is the problem with them?
07:49
eddippla
07:49 PM
oh
07:49
eddippla
07:49 PM
thats not that good lol
rinndoge
Photo of md5-ba6f113b7f3c6d6a6e849f8d5fed05bb
rinndoge
07:49 PM
💀
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
07:49 PM
4k rps is like nothing lmao
07:49
eddippla
07:49 PM
alright i definitely wont be using cf tunnels lol
rinndoge
Photo of md5-ba6f113b7f3c6d6a6e849f8d5fed05bb
rinndoge
07:49 PM
I'll stick to Reverse Proxy which can't be downed
07:49
rinndoge
07:49 PM
Just use Orgin rules
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
07:50 PM
woah i didnt know that, that makes stuff like a lot easier lol
rinndoge
Photo of md5-ba6f113b7f3c6d6a6e849f8d5fed05bb
rinndoge
07:50 PM
Set hostname to whatever full url you want or subdomain
07:50
rinndoge
07:50 PM
and then the 2nd port option
07:50
rinndoge
07:50 PM
boom
07:50
rinndoge
07:50 PM
put port number in
07:52
rinndoge
07:52 PM
September 27th
07:52
rinndoge
07:52 PM
I was having issues with them (ie. I had no clue you had to use hostname <:bruh:994760353936318495>)
07:52
rinndoge
07:52 PM
so I went with tunnels
07:52
rinndoge
07:52 PM
yk
07:52
rinndoge
07:52 PM
og
07:52
rinndoge
07:52 PM
Orgin Rules make Tunnels useless for my use case <a:laugh_hard:825135659458363434>
07:53
rinndoge
07:53 PM
eddippla If your going to proxy with CF you might like this https://github.com/Paul-Reed/cloudflare-ufw
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
07:53 PM
yeah origin rules seem lik they are realy good
07:53
eddippla
07:53 PM
i think i actually used that exact script
07:53
eddippla
07:53 PM
it works rly well
07:55
eddippla
07:55 PM
do you know where i can find the origin rules in my site
07:56
eddippla
07:56 PM
im reading the article rn
07:56
eddippla
07:56 PM
woah they give you 10 free rules?
07:56
eddippla
07:56 PM
thats a lot lmao
rinndoge
Photo of md5-ba6f113b7f3c6d6a6e849f8d5fed05bb
rinndoge
07:57 PM
but ok
07:57
rinndoge
07:57 PM
10 is actually rlly limiting
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
07:57 PM
honestly it seems like its a lot
07:57
eddippla
07:57 PM
compared to like page rules
rinndoge
Photo of md5-ba6f113b7f3c6d6a6e849f8d5fed05bb
rinndoge
07:57 PM
they put so little to discourage companies from just using free
07:57
rinndoge
07:57 PM
Pro only comes with better HTTP/2 & HTTP/3 prioritization
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
07:57 PM
how else are they supposed to make money lol
rinndoge
Photo of md5-ba6f113b7f3c6d6a6e849f8d5fed05bb
rinndoge
07:57 PM
eddippla They don't make money at all in general
They get money from government and government contracts
07:57
rinndoge
07:57 PM
CF is at a loss not a gain
07:58
rinndoge
07:58 PM
Their criticial itnernet infrastructure
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
07:58 PM
yeah but they have to minimize that loss
rinndoge
Photo of md5-ba6f113b7f3c6d6a6e849f8d5fed05bb
rinndoge
07:58 PM
Their paid to be exist at this rate
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
07:58 PM
true
rinndoge
Photo of md5-ba6f113b7f3c6d6a6e849f8d5fed05bb
rinndoge
07:58 PM
Their infrastructure is too large for consumers to entirely pay it
07:58
rinndoge
07:58 PM
Not even enterprise pays enough to warrant it
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
07:58 PM
bro that just seems like a impossible business then lmao
07:58
eddippla
07:58 PM
never going to be profitable?
rinndoge
Photo of md5-ba6f113b7f3c6d6a6e849f8d5fed05bb
rinndoge
07:59 PM
You would have to turn it around when you started
07:59
rinndoge
07:59 PM
One way you can is maximizing the amount of rps one server can handle
07:59
rinndoge
07:59 PM
if one server alone can handle 10,000,000 RPS on a consumer CPU
07:59
rinndoge
07:59 PM
then your profitability will be insane
08:00
rinndoge
08:00 PM
CF IPs are NATs
08:00
rinndoge
08:00 PM
of dozens of servers
08:00
rinndoge
08:00 PM
You can do it
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
08:00 PM
expensive
rinndoge
Photo of md5-ba6f113b7f3c6d6a6e849f8d5fed05bb
rinndoge
08:00 PM
You just need to optimize your code
08:00
rinndoge
08:00 PM
Not really
08:00
rinndoge
08:00 PM
Code matters
eddippla
Photo of md5-ddfecc10da4e1e79e7751cd88462d6af
eddippla
08:00 PM
well it does of course
rinndoge
Photo of md5-ba6f113b7f3c6d6a6e849f8d5fed05bb
rinndoge
08:00 PM
Just make a full on Rust reverse proxy
08:00
rinndoge
08:00 PM
Rust barely uses resources and is very effecient by default

Chatwoot

Chatwoot | Knowledge Base powered by Struct.AI

Indexed 2221 threads (46% resolved)

Generate Knowledge