Make sure API urls use the correct protocol

The API app is mounted inside another app, which in turn is mounted
inside a parent, so at the point the API is mounted the parent
doesn't have the trust proxy setting, so to fix the urls in the API
I've set some properties on the request object in the parent app,
which does correctly inherit the trust proxy setting.