Adapt code to be compatible with reverse proxy