Issue w/ nginx after updating

AI-generated summary

cookieman768 reported an nginx error after updating their Discourse installation: nginx: [emerg] host not found in set_real_ip_from "131.0.72.0/222400:cb00::/32". They suspected a Cloudflare-related regression, referencing two similar past issues. pfaffman suggested disabling Cloudflare optimizations and running git pull in /var/discourse. cookieman768 confirmed switching Cloudflare to DNS-only mode, but the error persisted. In a follow-up, they identified the root cause: a legacy custom set_real_ip_from configuration in their app.yml that conflicted with the newer Cloudflare template. After commenting out the custom section and letting the template handle the configuration, the issue was resolved. cookieman768 credited pfaffman for the guidance and noted their installation predated the template’s introduction, explaining the outdated config.

Hello :wave: - I just updated my installation today but, I encountered the following error, and it keeps repeating. I’m unable to access the site but, it looks like this should have been fixed earlier this year? These two posts seem to have the same issue, but I’m not sure what changed to break this again.

https://meta.discourse.org/t/discourse-updated-from-admin-not-working-after-rebuild-fatal-502-error-after-rebuild/200443?u=cookieman768

nginx: [emerg] host not found in set_real_ip_from "131.0.72.0/222400:cb00::/32" in /etc/nginx/conf.d/discourse.conf:116

Has anyone else encountered this? I’m just not sure what the fix would be unless something changed with Cloudflare yet again.

I would say to make cloudflare dns only or at least disable all optimization.

Next

cd /var/discourse
git pull 

And see if it succeeds.

So, like change it on cloudflare to be DNS only?

Hmm, yeah - it looks like the nginx: [emerg] host not found in set_real_ip_from "131.0.72.0/222400:cb00::/32" in /etc/nginx/conf.d/discourse.conf:116 is still being spammed in the logs even after setting Cloudflare to DNS only. If anyone has other troubleshooting ideas, I’m all for it! :slight_smile:

EDIT: I think I found the culprit - there was a custom commands section at the end of my app.yml it looks like in newer installs this is handled by the template. I’m commenting it out and using the template.

EDIT 2: Yeah, it looks like I installed Discourse before the template came out so my template was in the app.yml, simply removing it from the app.yml and using the template fixed it. Thank you for the help @pfaffman!