פגיעות Discourse CVE-2021-41163

That line will execute anyway, as that parameter is user input.

That may work, but as you stated is a band-aid. Rebuilding will remove the fix, and be very careful testing as nginx config is very tricky to get right.