Giter Site home page Giter Site logo

CORS problem about swagger-node HOT 6 CLOSED

swagger-api avatar swagger-api commented on April 30, 2024
CORS problem

from swagger-node.

Comments (6)

muanis avatar muanis commented on April 30, 2024

Try passing an Origin: header

Sent from my iPhone

On Feb 7, 2014, at 5:57 PM, Rifat Nabi [email protected] wrote:

curl -I -X OPTIONS "http://localhost:9090/api-docs"

HTTP/1.1 200 OK
X-Powered-By: Express
Allow: GET
Content-Type: text/html; charset=utf-8
Content-Length: 3
Date: Fri, 07 Feb 2014 22:55:01 GMT
Connection: keep-alive
curl -I "http://localhost:9090/api-docs"

HTTP/1.1 200 OK
X-Powered-By: Express
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE
Access-Control-Allow-Headers: Content-Type, api_key
Content-Type: application/json; charset=utf-8
Date: Fri, 07 Feb 2014 22:56:01 GMT
Connection: keep-alive
curl -I -X OPTIONS "http://petstore.swagger.wordnik.com/api/api-docs"

HTTP/1.1 204 No Content
Date: Fri, 07 Feb 2014 23:06:17 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, DELETE, PUT, PATCH, OPTIONS
Access-Control-Allow-Headers: Content-Type, api_key, Authorization
Allow: OPTIONS,GET,HEAD
Connection: close
I tried adding the setHeaders but no luck.


Reply to this email directly or view it on GitHub.

from swagger-node.

torifat avatar torifat commented on April 30, 2024

@muanis Just tried curl -I -X OPTIONS "http://localhost:9090/api-docs/" -H "Origin: http://localhost/". Same result.

from swagger-node.

torifat avatar torifat commented on April 30, 2024

Here's what I'm trying - https://github.com/torifat/angular-education/blob/master/api/server.js#L59

from swagger-node.

muanis avatar muanis commented on April 30, 2024

Try pointing your package.json to github master and follow the instructions at the end of the readme, I just pr something but I doubt it's on the npm repo already.

And don't replace the origin header. Let the cors module take care of it.

from swagger-node.

torifat avatar torifat commented on April 30, 2024

@muanis Yes, I noticed your PR. Thanks for the quick replies.

from swagger-node.

fehguy avatar fehguy commented on April 30, 2024

closing as this is outside the swagger module.

from swagger-node.

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.