Bad mobile path resolving


I want to restrict access to images via nginx with x-accel-redirect.

It seems, that all urls get prefixed with localhost:12752/ instead of my real server name like where my nginx is running on.

/secure/cat.jpg > working only on desktop > working on both

The mobile path is resolved to http://localhost:12752/secure/cat.jpg which is wrong.

The output on mobile: absoluteUrl()=

I don’t want to use these absolute urls all the time.
So how can i change the base-url for these files?