nginx location directive does not return http status
Because things get nasty when you use returns
not bound to any location {}
.
Put your return 412
inside location / {}
and there will be happiness and joy.
P.S. When your web-server returns empty answer, you should use 204 status, not 200. Both will work, but 204 shows you know things.