question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to enable cross origin completely?

See original GitHub issue

There’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:closed
  • Created 5 years ago
  • Comments:32 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
huashengduncommented, Jan 20, 2019

Updated: To disable xsrf protection by passing option --xsrf=False, To enable cross-origin websockets by passing option --origin='http://cross-domain.com'.

1reaction
huashengduncommented, Sep 12, 2018

To disable xsrf protection, your can change xsrf_cookies=True to xsrf_cookies=False in settings.py. To allow cross-origin traffic, you need to define a method check_origin on WsockHandler.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found