metosin/reitit

Bundled CORS-support

Open

#236 创建于 2019年3月11日

在 GitHub 查看
 (9 评论) (22 反应) (0 负责人)Clojure (1,569 star) (261 fork)batch import
enhancementhelp wanted

描述

Currently, a third party mw/interceptor is needed for CORS. There should be a fast default mw & interceptor for this. Those could be configured either via route data or via mw/interceptor options. Example data format from https://github.com/metosin/reitit/issues/143#issuecomment-422079662:

{:access-control
 {:allow-origin "http://foo.example"
  :allow-methods #{:get :post :put}
  :allow-credentials true
  :allow-headers #{"X-PINGOTHER" "Content-Type"}
  :expose-headers #{"X-My-Custom-Header" "X-Another-Custom-Header"}
  :max-age 86400}}

Some prior work:

Related issues:

贡献者指南