how to enable cross origin completely?
See original GitHub issueThere’s an iframe in my local index.html,like this:
<iframe src="localhost:8888"></iframe>
I tried to add following code in both class IndexHandler and class WsockHandler:
def set_default_headers(self):
self.set_header("Access-Control-Allow-Origin", "*")
self.set_header("Access-Control-Allow-Headers", "x-requested-with")
self.set_header('Access-Control-Allow-Methods', 'GET, PUT, DELETE, OPTIONS')
self.set_header("Access-Control-Allow-Headers", "access-control-allow-origin,authorization,content-type")
but ajax_complete_callback still returned “XSRF cookie does not match POST argument”.
Help me please.
Issue Analytics
- State:
- Created 5 years ago
- Comments:32 (17 by maintainers)
Top Results From Across the Web
CORS Enabled - W3C Wiki
Open Internet Information Service (IIS) Manager · Right click the site you want to enable CORS for and go to Properties · Change...
Read more >Cross-Origin Resource Sharing (CORS) - MDN Web Docs
The CORS mechanism supports secure cross-origin requests and data transfers between browsers and servers. Modern browsers use CORS in APIs such ...
Read more >The ultimate guide to enabling Cross-Origin Resource ...
To allow all origins to access the resources in the case of a public API, the Access-Control-Allow-Origin header can be set to *...
Read more >Enabling cross-origin resource sharing (CORS)
Enabling cross -origin resource sharing (CORS) · Log in to the Fastly web interface. · From the Home page, select the appropriate service....
Read more >Enabling Cross Origin Requests for a RESTful Web Service
You can enable cross-origin resource sharing (CORS) from either in individual controllers or globally. The following topics describe how to do so: Controller ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Updated: To disable xsrf protection by passing option
--xsrf=False
, To enable cross-origin websockets by passing option--origin='http://cross-domain.com'
.To disable xsrf protection, your can change
xsrf_cookies=True
toxsrf_cookies=False
in settings.py. To allow cross-origin traffic, you need to define a methodcheck_origin
on WsockHandler.