-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot load CORS content #38
Comments
Hi there, sorry to hear you are having trouble. I would love to try and help, can you help me to confirm that there are no CORS headers being returned? If you run your Flask server, and curl the headers: What is returned? Also, can you confirm that your scrape_char route is not erroring out? Currently, if an unhandled exception occurs, then Flask-Cors is not involved in returning the 500 response, and thus it will not contain CORS headers. This can be tricky to debug, and I will be changing it in the future. |
Hey, thanks for the fast response! Here's what I see: brianauron@Resisty ~/character_scraper % curl -I http://127.0.0.1:5000/character_scrape To make sure the endpoint actually works, I've been using wget: which is correct data. If it matters, I don't see anything unusual in the Flask debug log. |
I think the last time I posted my code was in a revision without your module. Just now, I tried with telnet: brianauron@Resisty ~/character_scraper % telnet localhost 5000 HTTP/1.0 200 OK { |
@Resisty that looks like the CORS headers are being sent correctly. Can you confirm that the problem is resolved? |
@wcdolphin No, sorry. Those headers show up in curl/telnet/etc but chrome web developer still shows the no header error and the content fails to show up. |
Okay, no worries, we will get to the bottom of this! Can you help me by answer a few questions and verify a few of my assumptions? So presumably you are hosting some HTML/JS from a webserver (eg node http-server, or similar) on port 8000 which is making an AJAX request to a flask app running on 5000, is that correct?
|
Hi @wcdolphin I really appreciate all the help, but I've just changed my code to rely solely on Flask and not at all on a separate service. Given everything I've tried tonight I think most of this issue is me and not your project, so don't worry about it. Thanks again! |
Hello, I happened across your project after banging my head against trying to make an XMLHttpRequest in my javascript against my flask code (running on the same server, ports 8000 and 5000, respectively). No matter what I try, nothing gets past the "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access." error. From flask:
8 from flask.ext.cors import cross_origin
...
39 @app.route('/character_scrape', methods=['GET', 'POST'])
40 @cross_origin(headers=['Content-Type'])
41 @on_subnet
42 def scrape_char():
Thanks for your time!
The text was updated successfully, but these errors were encountered: