I think that you can remove the after web config section. I believe it’ll do the redirect without it.
I think that there have been some changes to the nginx config since that code worked and that it now redirects everything to the Discourse hostname.