Code Monkey home page Code Monkey logo

Comments (9)

asvetlov avatar asvetlov commented on September 2, 2024 1

@wumpus sorry.
Please ping me in, say, 10 days.
Ok?
I have no free time to work on the issue personally now (review only maybe) but really want to get CORS plugin working.
Last months worked hard on CPython, added several important changes to asyncio. Have to finish this job before returning back to aio-libs projects.

from aiohttp-cors.

asvetlov avatar asvetlov commented on September 2, 2024

If you provide a patch I'm happy to review it.

from aiohttp-cors.

wumpus avatar wumpus commented on September 2, 2024

I suspect it's a bug that aiohttp-cors works great for GET and throws a configuration error for method '*'.

I don't see any tests for method '*' actually working. There are tests in tests/unit/test_cors_config related to webviews and mixins. That appears to be the only tests related to method '*'.

aiohttp-graphl is an example of middleware that expects method='*' to work

from aiohttp-cors.

wumpus avatar wumpus commented on September 2, 2024

Ping.

I think the basic issue is:

  • CORS preflight request is a OPTIONS
  • Lazy coders create routes to method='*' in middleware like aiohttp-graphl
  • aiohttp-cors treats method='*' specially because it includes OPTIONS
  • it would be nice if the middleware still worked

from aiohttp-cors.

amaksymov avatar amaksymov commented on September 2, 2024

Hi, @asvetlov !
I encountered the same error. Are there any solutions?

from aiohttp-cors.

jogc avatar jogc commented on September 2, 2024

Same problem here

from aiohttp-cors.

wumpus avatar wumpus commented on September 2, 2024

@andrii-maksymov and @jogc what middleware are you using?

from aiohttp-cors.

jogc avatar jogc commented on September 2, 2024

this is what i do, there is no other middleware used

aiohttp_jinja2.setup(app,
    loader = jinja2.FileSystemLoader(os.path.dirname(os.path.abspath(__file__)) + '/templates'),
    extensions = [ 'pypugjs.ext.jinja.PyPugJSExtension' ])

aiohttp_graphql.GraphQLView.attach(app, schema = schema,
    graphiql = True)

cors = aiohttp_cors.setup(app, defaults={
    'http://127.0.0.1:3000': aiohttp_cors.ResourceOptions(
        allow_credentials=True,
        expose_headers='*',
        allow_headers=('Content-Type',),
    )
})

from aiohttp-cors.

wumpus avatar wumpus commented on September 2, 2024

Thanks @jogc so you're using exactly the same middleware that I am.

Here is my patch that works around the problem in aiohttp_graphql, by handling every method other than OPTIONS:

graphql-python/aiohttp-graphql@master...wumpus:master

from aiohttp-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.