aio-libs / aio-libs/aiohttp-cors

Only 1 is allowed

オープン
#271 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
220
フォーク
61
平均マージ
2分
マージ済み PR(30日)
3

説明

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。