python - How to cross-domain in cherrypy normal application? -
class helloworld: @cherrypy.expose def hello(self): return "hello world!" cherrypy.quickstart(helloworld()) i cross-domain request: http://ip:port/hello unsuccessfully, , add decorator(which working in restful application) before method hello that: def crossdomain(func): def decorate(*args, **kwargs): cherrypy.response.headers["access-control-allow-origin"] = "*" cherrypy.response.headers["access-control-allow-methods"] = "get, post, head, put, delete" allow_headers = ["cache-control", "x-proxy-authorization", "x-requested-with", "content-type"] cherrypy.response.headers["access-control-allow-headers"] = ",".join(allow_headers) return func(*args, **kwargs) return decorate class helloworld: @cherrypy.expose @crossdomain def hello(self): return "hello world!" cherrypy.quick...