The discussion revolves around Discourse displaying CloudFlare’s IP address instead of the user’s real IP, caused by CloudFlare’s reverse proxy. honeymoose explains that this can be resolved by configuring Discourse with a cloudflare.template.yml file and rebuilding the instance using ./launcher rebuild app. sober reports intermittent 502 errors and slower performance when using CloudFlare with a Chinese server, which honeymoose attributes to server response time. sober later resolves the issue by fixing TCP load balancing but ultimately abandons CloudFlare due to performance issues. honeymoose suggests that without ICP备案, Tencent’s acceleration might be better than CloudFlare. sober notes Tencent’s service is costly. honeymoose shares that their Tencent acceleration cost is under 5 yuan per month. 5804829 encounters a boot failure on Rocky 9.3 when adding CloudFlare IPs, but it resolves after a server restart. honeymoose suspects Docker or OS version issues, while 5804829 notes the problem occurs on Alibaba Cloud but not on other platforms, possibly due to modified OS versions. honeymoose links to a similar issue on Discourse Meta. The thread also briefly touches on a Bilibili video plugin issue, with honeymoose suggesting an alternative solution, and joo noting the plugin is no longer user-friendly.
The IP addresses obtained by all Discourse users are actually the IP addresses of CloudFlare’s servers.
Modification
Fortunately, Discourse has already provided a solution.
You need to add the following content to Discourse’s configuration file:
“templates/cloudflare.template.yml”
Then rebuild your Discourse installation instance.
./launcher rebuild app
The above command can be used to directly rebuild Discourse. It should be noted that the rebuild takes about 10 minutes, during which the system is inaccessible.
Refresh the system again to check, and the system can now obtain the correct IP address.
Boss, is this using CloudFlare’s CDN proxy acceleration? Why am I always getting a 502 error from CloudFlare to the origin server? It occasionally works. The origin server is in China. Is it a network issue, an SSL certificate issue, or are there any CloudFlare configurations to pay attention to?
The problem has been found. I was using TCP load balancing for internal forwarding and it was not configured correctly. It has since been fixed. However, the origin server is in China, and using CloudFlare actually made it slower. I have now abandoned CloudFlare. Internal forwarding also involves parsing the user IP address, which was resolved using real_ip_header proxy_protocol.
There are ICP filing issues. If it is a domestic server, there are no filing issues. Using Tencent’s full-site data acceleration may be better than CloudFlare.
The filing has been processed. I tried Alibaba’s, and the acceleration is fine, but it’s quite expensive. How is Tencent’s pricing? Cloudflare is free.
I switched to ubuntu22.04 and it’s still giving the same error
FAILED
Pups::ExecError: /tmp/add-cloudflare-ips failed with return #<Process::Status: pid 4279 exit 8>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn’
exec failed with the params “/tmp/add-cloudflare-ips”
bootstrap failed with exit code 8
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
Pups::ExecError: /tmp/add-cloudflare-ips failed with return #<Process::Status: pid 5134 exit 8>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn’
exec failed with the params “/tmp/add-cloudflare-ips”
bootstrap failed with exit code 8
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
f51291d274ba2564076ba412f28fb445db9c916f00a6d1fb76d2613e773ccfcf
I don’t know what’s going on!!!