Skip to content
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

Only 1 is allowed #271

Open
Dashing-Nelson opened this issue Oct 21, 2019 · 1 comment
Open

Only 1 is allowed #271

Dashing-Nelson opened this issue Oct 21, 2019 · 1 comment

Comments

@Dashing-Nelson
Copy link

Dashing-Nelson commented Oct 21, 2019

Hello,
I am trying to work on a project, and I am facing an issue.
The problem is that when I am requesting a resource from the server, google chrome is saying that the "Access-Control-Allow-Origin' header contains multiple values"
This is my code

@asyncio.coroutine
def handler(request):
    return web.Response(
        text="Hello!",
        headers={
            "X-Custom-Server-Header": "Custom data",
        })


app = web.Application()

cors = aiohttp_cors.setup(app)

resource = cors.add(app.router.add_resource("/"))

route = cors.add(
    resource.add_route("POST", handler), {
        "*": aiohttp_cors.ResourceOptions(allow_methods="*",
                                          allow_headers=("X-Requested-With", "Content-Type", "AUTHORIZATION"),
                                          expose_headers="*",
                                          allow_credentials=False
                                          )
    })
if __name__ == '__main__':
    web.run_app(app, port=os.getenv("PORT"), host='0.0.0.0')

i am serving aiohttp over nginx

@asvetlov
Copy link
Member

Do you have a stack trace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants