Git Product home page Git Product logo

Comments (7)

corydolphin avatar corydolphin commented on July 17, 2024

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:
curl -I http://127.0.0.1:5000/character_scrape

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.

from flask-cors.

Resisty avatar Resisty commented on July 17, 2024

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
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 77
Server: Werkzeug/0.9.6 Python/2.7.6
Date: Thu, 31 Jul 2014 01:22:39 GMT

To make sure the endpoint actually works, I've been using wget:
brianauron@Resisty ~/character_scraper % wget -qO- --post-data="character=Alaali&realm=cenarius" localhost:5000/character_scrape
{
"class": "Shaman",
"level": "90",
"race": "Draenei",
"spec tip": "Elemental"
}

which is correct data.

If it matters, I don't see anything unusual in the Flask debug log.

from flask-cors.

Resisty avatar Resisty commented on July 17, 2024

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
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /character_scrape HTTP/1.1

HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 77
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type
Server: Werkzeug/0.9.6 Python/2.7.6
Date: Thu, 31 Jul 2014 01:55:44 GMT

{
"class": "N/A",
"level": "0",
"race": "N/A",
"spec tip": "N/A"
}

from flask-cors.

corydolphin avatar corydolphin commented on July 17, 2024

@Resisty that looks like the CORS headers are being sent correctly. Can you confirm that the problem is resolved?

from flask-cors.

Resisty avatar Resisty commented on July 17, 2024

@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.

from flask-cors.

corydolphin avatar corydolphin commented on July 17, 2024

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?

  1. I see that one of your url params is 'realm', is this service intended to be behind HTTP Auth?
  2. In the chrome developer console, can you confirm what the AJAX request headers and response are? Is the content what you expect? The status code what you expect?

from flask-cors.

Resisty avatar Resisty commented on July 17, 2024

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!

from flask-cors.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.