Add option to use browser's hostname if we know the api docs and api rest service are on the same server.

This will allow the sandbox to continue to work if the browser's location and the api basepath have different hostnames. We make the assumption that the api docs and api service are on the same server in order to provide a better enduser experience, instead of being blocked by CSRF prevention mechanisms