I have two domain names, for example domain1.com and domain1.org. All requests from domain1.com are redirected to domain1.org, with uri of course. How can I check with nginx that uri on domain1.org returns 200 response code and only after this do redirect. If the code will be 404 or another just return this code from domain1.com without any redirect.