There is an nginx directive absolute_redirect
available from nginx version 1.11.8, which is enabled by default. If disabled, redirects issued by nginx will be relative. This issue is a bit older, but maybe useful for all of you hitting it from google.
absolute_redirect off;