Very ugly CORS workaround, should be redesigned as soon as I get the idea how to do it.