diff --git a/static-data/official-plugins/rpc/main.py b/static-data/official-plugins/rpc/main.py index b713f48d..9afcc9b7 100644 --- a/static-data/official-plugins/rpc/main.py +++ b/static-data/official-plugins/rpc/main.py @@ -60,6 +60,12 @@ class OnionrRPC(object): @cherrypy.expose def rpc(self): # Dispatcher is dictionary {: callable} + + if cherrypy.request.method == 'OPTIONS': + cherrypy.response.headers['Access-Control-Allow-Origin'] = '*' + cherrypy.response.headers['Access-Control-Allow-Methods'] = 'POST' + return '' + data = cherrypy.request.body.read().decode('utf-8') response = JSONRPCResponseManager.handle(data, dispatcher)