plug_cors:CORS插头

时间:2021-05-13 21:26:28
【文件属性】:
文件名称:plug_cors:CORS插头
文件大小:12KB
文件格式:ZIP
更新时间:2021-05-13 21:26:28
Elixir 弃用:请改用 PlugCors 用于插件的CORS中间件。 安装 将以下内容添加到mix.exs文件中的deps部分。 defp deps do [ .. . { :plug_cors , " ~> 0.7.3 " }] end 完成后,在您的外壳中运行mix deps.get来获取和编译PlugCors。 用法 plug PlugCors , origins: [ " test.origin.test " , " *.domain.com " ], methods: [ " GET " , " POST " ], headers: [ " Authorization " ] 如果与Phoenix一起使用,请确保在路由器上方定义插头。 这样一来,插件即可正确响应浏览器对CORS发出的OPTIONS请求,并阻止404对浏览器的CORS请求做出响应。 defmodu
【文件预览】:
plug_cors-master
----mix.exs(883B)
----lib()
--------plug_cors.ex(4KB)
--------plug_cors()
----config()
--------config.exs(1005B)
----test()
--------plug_cors_test.exs(8KB)
--------test_helper.exs(15B)
----LICENSE.md(11KB)
----README.md(2KB)
----mix.lock(225B)
----.gitignore(55B)
----CHANGELOG.md(250B)

网友评论