import json
urls = (
'/api', 'api'
)
app = web.application(urls, globals())
class api:
def POST(self):
web.header('Content-Type', 'application/json')
web.header('Access-Control-Allow-Origin', 'http://localhost:80')
data = {}
data["foo"] ="Hello"
return json.dumps(data)
if __name__ == "__main__":
app.run()
I am trying to use the default 8080 port of this http://localhost:8080/api from Apache http://localhost page in port 80. However, in the response web.py is not sending 'Access-Control-Allow-Origin' to the browser and I get
Access to fetch at 'http://localhost:8080/api' from origin 'http://localhost' has been blocked by CORS policy:
Response to preflight request doesn't pass access control check:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
I am trying to use the default 8080 port of this
http://localhost:8080/apifrom Apachehttp://localhostpage in port 80. However, in the response web.py is not sending 'Access-Control-Allow-Origin' to the browser and I get