top

Package cors is net/http handler to handle CORS related requests as defined by http://www.w3.org/TR/cors/

You can configure it by passing an option struct to cors.New:

c := cors.New(cors.Options{
    AllowedOrigins: []string{"foo.com"},
    AllowedMethods: []string{"GET", "POST", "DELETE"},
    AllowCredentials: true,
})

Then insert the handler in the chain:

handler = c.Handler(handler)

See Options documentation for more options.

The resulting handler is a standard net/http handler.

Imported by 405 package(s)

  1. github.com/01walid/echo/recipes/google-app-engine
  2. github.com/01walid/echo/recipes/website
  3. github.com/8legd/echo/example
  4. github.com/CentaurWarchief/rasp3
  5. github.com/CenturyLinkLabs/imagelayers/server
  6. github.com/DallanQ/migrations-server
  7. github.com/Dieterbe/comma
  8. github.com/DveMac/todo-service
  9. github.com/EOGILE/agilestack-login-ui
  10. github.com/EOGILE/agilestack-secu-admin/secu-admin-api
  11. github.com/Earthdollar/go-earthdollar/rpc/comms
  12. github.com/FederationOfFathers/dashboard/api
  13. github.com/FederationOfFathers/stats-to-mysql
  14. github.com/FederationOfFathers/user-registry
  15. github.com/G-pu/gpu/recipes/google-app-engine
  16. github.com/G-pu/gpu/recipes/website
  17. github.com/GeorgFleig/sophos-utm9/restd
  18. github.com/IanLewis/homepage/api
  19. github.com/Igor-K/minio
  20. github.com/Jackong/cors-srv
  21. github.com/K4orta/lunchclub-api
  22. github.com/K4orta/reaper-api
  23. github.com/Kedarnag13/Golang-Alarm
  24. github.com/Kedarnag13/Online_test
  25. github.com/KloudKtrl/internal/base
  26. github.com/KloudKtrl/upload-prototype
  27. github.com/LeKovr/elsample
  28. github.com/ListHub/please/api
  29. github.com/MNegi/ampersand-rethink-go
  30. github.com/MaKleSoft/padlock-cloud/padlockcloud
  31. github.com/MaKleSoft/padlock-pay
  32. github.com/MustWin/cors/examples/alice
  33. github.com/MustWin/cors/examples/default
  34. github.com/MustWin/cors/examples/goji
  35. github.com/MustWin/cors/examples/martini
  36. github.com/MustWin/cors/examples/negroni
  37. github.com/MustWin/cors/examples/nethttp
  38. github.com/MustWin/cors/examples/openbar
  39. github.com/MustWin/go-base/app
  40. github.com/Mustwin/cors/examples/alice
  41. github.com/Mustwin/cors/examples/default
  42. github.com/Mustwin/cors/examples/goji
  43. github.com/Mustwin/cors/examples/martini
  44. github.com/Mustwin/cors/examples/negroni
  45. github.com/Mustwin/cors/examples/nethttp
  46. github.com/Mustwin/cors/examples/openbar
  47. github.com/Mustwin/go-base/app
  48. github.com/N1xx1/Helen
  49. github.com/Newbourne/dimples-api
  50. github.com/PuppyKhan/pillar/app/pillar/handler
  51. github.com/Qwinix/Golang-Alarm
  52. github.com/SamuelRamond/xauth/server
  53. github.com/SolarCity/ftb_milestoneapi
  54. github.com/TF2Stadium/Helen
  55. github.com/TimurStash/gochat
  56. github.com/UnnoTed/Helen
  57. github.com/UnnoTed/aInstaller
  58. github.com/ZehCnaS34/echo/example
  59. github.com/achiku/sample-golang-xhandler
  60. github.com/admpub/echo-example/google-app-engine
  61. github.com/admpub/echo-example/website
  62. github.com/aleksandr-vin/cors/examples/alice
  63. github.com/aleksandr-vin/cors/examples/default
  64. github.com/aleksandr-vin/cors/examples/goji
  65. github.com/aleksandr-vin/cors/examples/martini
  66. github.com/aleksandr-vin/cors/examples/negroni
  67. github.com/aleksandr-vin/cors/examples/nethttp
  68. github.com/aleksandr-vin/cors/examples/openbar
  69. github.com/aleksandr-vin/cors/examples/xhandler
  70. github.com/alfg/echo/example
  71. github.com/alioygur/echo/recipes/google-app-engine
  72. github.com/alioygur/echo/recipes/website
  73. github.com/alioygur/goaligo/app
  74. github.com/alphazero/go-ethereum/rpc
  75. github.com/apihub/apihub/gateway/middleware
  76. github.com/apuigsech/rest-layer/examples/demo
  77. github.com/archsaber/echo/recipes/google-app-engine
  78. github.com/archsaber/echo/recipes/website
  79. github.com/auroralaboratories/corona-api
  80. github.com/awakenetworks/rest-layer/examples/cors
  81. github.com/awakenetworks/rest-layer/examples/demo
  82. github.com/awaseem/blob
  83. github.com/aymerick/kowa/server
  84. github.com/bas-vk/go-ethereum/rpc
  85. github.com/bdehamer/imagelayers/server
  86. github.com/bentranter/ampersand-rethink-go
  87. github.com/bentranter/cprox
  88. github.com/binary132/mf-proto
  89. github.com/blacksails/mailspree/http
  90. github.com/blockc/go-ethereum/rpc
  91. github.com/bookerzzz/imaginary
  92. github.com/bpicolo/picfit/application
  93. github.com/brandfolder/freegeoip/apiserver
  94. github.com/brandonblack/go-ethereum/rpc
  95. github.com/brandonvfx/sg-restful
  96. github.com/breathingdust/house.api
  97. github.com/brg-liuwei/echo/example
  98. github.com/cagedtornado/centralconfig/cmd
  99. github.com/ch3lo/inspector/api
  100. github.com/ch3lo/overlord/api
  101. github.com/chop-dbhi/data-models-service
  102. github.com/chop-dbhi/origins/http
  103. github.com/chrisprice/reset-fork-to-upstream
  104. github.com/chybie/go-angular/backend
  105. github.com/ckeyer/go-ethereum/rpc
  106. github.com/ckpt/backend-services
  107. github.com/clawio/clawiod/server
  108. github.com/clippy-io/clippy-api-go
  109. github.com/cnaize/imaginary
  110. github.com/codeignition/marksman
  111. github.com/codeui/chevent-web/api/mware
  112. github.com/copperhead/android_ota_manager
  113. github.com/coralproject/pillar/app/pillar/handler
  114. github.com/currantlabs/echo/recipes/google-app-engine
  115. github.com/currantlabs/echo/recipes/website
  116. github.com/cyService/service-cxtool/requesthandlers
  117. github.com/cytoscape-ci/service-cx/requesthandlers
  118. github.com/cytoscape-ci/service-cxtool/requesthandlers
  119. github.com/cytoscape-ci/service-idmapping/requesthandlers
  120. github.com/cytoscape-ci/service-template-go/requesthandlers
  121. github.com/d-ronin/autotown
  122. github.com/danesparza/calendar-service
  123. github.com/danesparza/centralconfig/cmd
  124. github.com/danesparza/forecast-service
  125. github.com/danesparza/twitter-breaking-news
  126. github.com/daniloanp/minio
  127. github.com/dave-andersen/pisearch/piweb
  128. github.com/davidmz/aproxy33
  129. github.com/davidmz/frf-userdata
  130. github.com/dcu/git-http-server
  131. github.com/de1ux/nathanandlauren/server
  132. github.com/derekdowling/gardenswap-api/api
  133. github.com/dfreire/echo/recipes/google-app-engine
  134. github.com/dfreire/echo/recipes/website
  135. github.com/dictyBase/authserver/commands
  136. github.com/dictyBase/go-middlewares/middlewares/cors
  137. github.com/dictybase/authserver/commands
  138. github.com/djinn/minio
  139. github.com/dlsniper/echo/example
  140. github.com/dmsm/5c-hack-spring15-back/api
  141. github.com/dre1080/echo/examples/website
  142. github.com/ds0nt/web-commander
  143. github.com/dst-hackathon/socialradar-api
  144. github.com/dtannen/satellite
  145. github.com/echo-contrib/echo-middleware/examples
  146. github.com/eogile/agilestack-login-ui
  147. github.com/eogile/agilestack-secu-admin/secu-admin-api
  148. github.com/eris-ltd/eris-cli/agent
  149. github.com/erraroo/erraroo/api
  150. github.com/ethereum/go-ethereum/rpc
  151. github.com/ethereumproject/go-ethereum/rpc
  152. github.com/fabioberger/go-ethereum/rpc
  153. github.com/farazdagi/go-ethereum/rpc
  154. github.com/fcasserfelt/sparkapi
  155. github.com/fiatjaf/imagebase64er.alhur.es
  156. github.com/fiatjaf/summadb/handle
  157. github.com/fiorix/freegeoip/apiserver
  158. github.com/furio/widserve/server
  159. github.com/fwessels/minio-xl
  160. github.com/garoevans/data-provider-service-go
  161. github.com/gautamrege/minio
  162. github.com/geektrust/findfalcone
  163. github.com/ghetzel/pivot
  164. github.com/ghostnetwrk/ghostnet/rpc/comms
  165. github.com/gleicon/freegeoip/apiserver
  166. github.com/gmbuell/frontend
  167. github.com/gnidan/foodtastechess/server
  168. github.com/grounded042/capacious/middleware
  169. github.com/h2non/imaginary
  170. github.com/h3poteto/fascia
  171. github.com/hackintoshrao/minio
  172. github.com/hariharan-uno/marksman
  173. github.com/helm/monocular/src/api/swagger/restapi
  174. github.com/helphone/api
  175. github.com/helpnumber/api
  176. github.com/hexadecy/cors/examples/echoV2
  177. github.com/hexadecy/echox/recipe/cors
  178. github.com/hexadecy/echox/recipe/google-app-engine
  179. github.com/hobeone/gonab/api
  180. github.com/husobee/echo/examples/website
  181. github.com/ianwalter/flash/lib
  182. github.com/icobani/stack/mware
  183. github.com/igor-k/minio
  184. github.com/ilgooz/stack/mware
  185. github.com/ilove789110/go-ethereum/rpc
  186. github.com/immesys/bw2bc/rpc
  187. github.com/impronunciable/hackdash-api
  188. github.com/indykish/cadvisor
  189. github.com/insionng/echo/examples/website
  190. github.com/ipfs/go-commands/http
  191. github.com/iron-io/imagelayers/server
  192. github.com/itpkg/chaos/web
  193. github.com/iyee/imaginary
  194. github.com/jelder/beacon
  195. github.com/jelinden/go-isomorphic-react
  196. github.com/jelinden/go-isomorphic-react-v8
  197. github.com/jelinden/go-react-seed
  198. github.com/jeremyje/gowebserver/server
  199. github.com/jesselucas/minio
  200. github.com/jfbus/picfit/application
  201. github.com/jimmyplaza/RethinkDB-Instagram
  202. github.com/jlgerber/sg-restful
  203. github.com/jllopis/gouncer
  204. github.com/jonog/redalert/web
  205. github.com/juanolon/echo/example
  206. github.com/jumbucks/go-jumbucksee/rpc
  207. github.com/kahing/minio/pkg/server/api
  208. github.com/kamlendrachauhan/CMPE273
  209. github.com/kedarnag13/Online_test
  210. github.com/keighl/glue-gun/app
  211. github.com/keighl/ifttt-glue
  212. github.com/keiono/service-cx/requesthandlers
  213. github.com/kiasaki/steamy/steamy-api
  214. github.com/kkaribu/cybele
  215. github.com/krishnasrinivas/minio-fs
  216. github.com/kristhompson/makingkoms
  217. github.com/kristofer/echo/example
  218. github.com/ksshannon/freegeoip/apiserver
  219. github.com/ktsimpso/holla_holla_server
  220. github.com/kucuny/delibird/server
  221. github.com/kujenga/cors/examples/alice
  222. github.com/kujenga/cors/examples/default
  223. github.com/kujenga/cors/examples/goji
  224. github.com/kujenga/cors/examples/martini
  225. github.com/kujenga/cors/examples/negroni
  226. github.com/kujenga/cors/examples/nethttp
  227. github.com/kujenga/cors/examples/openbar
  228. github.com/kwanp1/hubdorapi
  229. github.com/kyani-inc/echo/recipes/google-app-engine
  230. github.com/kyani-inc/echo/recipes/website
  231. github.com/lab-D8/lol-at-pitt
  232. github.com/lab-d8/lol-at-pitt
  233. github.com/lavab/invite-api
  234. github.com/leekchan/echo/examples/website
  235. github.com/listhub/please/api
  236. github.com/lming/echo/recipes/google-app-engine
  237. github.com/lming/echo/recipes/website
  238. github.com/lowply/soichi-mizutani.com
  239. github.com/lyfjx87/echo/examples/website
  240. github.com/m0sth8/echo/recipes/google-app-engine
  241. github.com/m0sth8/echo/recipes/website
  242. github.com/maklesoft/padlock-cloud/padlockcloud
  243. github.com/mattn/bolt/example
  244. github.com/mattyr/minio
  245. github.com/maxnachlinger/go-test
  246. github.com/mb-dev/plot-my-trip
  247. github.com/mcntsh/asana-task-bot
  248. github.com/mcntsh/go-api-starter
  249. github.com/megamsys/cadvisor
  250. github.com/mfcollins3/website-api/api
  251. github.com/michael-golfi/rules/server
  252. github.com/micromdm/micromdm
  253. github.com/micromdm/micromdm/app
  254. github.com/microscaling/imagelayers/server
  255. github.com/migueltorreslopez/go-ethereum/rpc
  256. github.com/miha-stopar/e2ee-server
  257. github.com/mikerjacobi/goji-skeleton
  258. github.com/minio/attic/minio-xl
  259. github.com/minio/minio/cmd
  260. github.com/mirrr/imaginary
  261. github.com/mmpg/api
  262. github.com/mnegi/ampersand-rethink-go
  263. github.com/morpheyesh/cadvisor
  264. github.com/morpheyesh/megamd/api
  265. github.com/mre/echo/example
  266. github.com/nagydani/go-ethereum/rpc
  267. github.com/nathandao/vantaa
  268. github.com/ncw/minio
  269. github.com/nerdzeu/nerdz-api
  270. github.com/netlify/authlify/api
  271. github.com/netlify/gocommerce/api
  272. github.com/netlify/netlify-git-api/api
  273. github.com/newtechfellas/IamOkApis
  274. github.com/niilo/api-server-example/api
  275. github.com/nildev/api-host/endpoints
  276. github.com/nildev/artemis/endpoints
  277. github.com/nilslice/echo/example
  278. github.com/nilslice/imaginary
  279. github.com/ninnemana/boomer
  280. github.com/nlefler/4sq_push
  281. github.com/nlefler/gcm-playground/server
  282. github.com/nmonterroso/lolchest.win/restapi
  283. github.com/nobonobo/p2pfw/signaling/server
  284. github.com/nobonobo/p2pfw/turnserver
  285. github.com/npolar/gouncer
  286. github.com/nsf/picfit/application
  287. github.com/nyaxt/otaru/mgmt
  288. github.com/nylar/miru
  289. github.com/obscuren/go-ethereum/rpc
  290. github.com/obscuren/hyperledger/rpc
  291. github.com/oinume/lekcije/server/controller/middleware
  292. github.com/ok-borg/api
  293. github.com/optick/lens/lib
  294. github.com/ory-am/workshop-dbg
  295. github.com/owulveryck/go-ethereum/rpc
  296. github.com/oxfeeefeee/appgo
  297. github.com/oxfeeefeee/appgo/server
  298. github.com/paked/mentor-backend
  299. github.com/panyingyun/freegeoip/apiserver
  300. github.com/pastjean/slackarch
  301. github.com/pcasaretto/go-ethereum/rpc/comms
  302. github.com/pieperz/BallPingHammer-Api/middleware
  303. github.com/pieperz/beedoop-go
  304. github.com/pmcgrath/echo/example
  305. github.com/pocke/smart-slide
  306. github.com/prabirshrestha/echo/recipes/google-app-engine
  307. github.com/prabirshrestha/echo/recipes/website
  308. github.com/prakashsanker/EdData
  309. github.com/purpleworks/delibird/server
  310. github.com/qixingyue/echo/example
  311. github.com/qtzheng/echo/recipes/google-app-engine
  312. github.com/qtzheng/echo/recipes/website
  313. github.com/qube81/echo-sample
  314. github.com/raintank/metrictank/api/middleware
  315. github.com/rande/gonode/core/security
  316. github.com/raphael/echo/examples/web
  317. github.com/rdegges/ipify-api
  318. github.com/remony/Equipment-Rental-API/core/server
  319. github.com/remotejob/gmailhandler/server
  320. github.com/remotejob/go_cv/app
  321. github.com/remotejob/weathermap_go
  322. github.com/rht/go-ethereum/rpc
  323. github.com/ricorx7/gohttp
  324. github.com/rodrwan/mercurius/server
  325. github.com/rs/rest-layer/examples/cors
  326. github.com/rs/rest-layer/examples/demo
  327. github.com/saifabid/freegeoip/apiserver
  328. github.com/samcf/hnefatafld
  329. github.com/samuelramond/xauth/server
  330. github.com/satanson/go-ethereum/rpc
  331. github.com/seanhagen/adventurelookup
  332. github.com/seanhagen/car-gasoline-tracker
  333. github.com/seanhagen/list-all-org-prs/server
  334. github.com/seesawlabs/ivan-kirichenko-exercise/application
  335. github.com/seiflotfy/minio
  336. github.com/sekimura/echo/example
  337. github.com/selasiehanson/sample_bank_server
  338. github.com/shashidharatd/minio
  339. github.com/shiftcurrency/go-ethereum/rpc
  340. github.com/shiftcurrency/shift/rpc
  341. github.com/sichacvah/portable_chat/api
  342. github.com/simple0812/echo/recipes/google-app-engine
  343. github.com/simple0812/echo/recipes/website
  344. github.com/sindbis/imaginary
  345. github.com/sk1LLb0X/Helen
  346. github.com/smacken/RestCompare/go
  347. github.com/smacken/goweb
  348. github.com/smothiki/minio.io
  349. github.com/solarcity/ftb_milestoneapi
  350. github.com/solher/zest
  351. github.com/sorennielsen/stack/mware
  352. github.com/sourcec0de/freegeoip/apiserver
  353. github.com/sreeram-boyapati/minio
  354. github.com/sryanyuan/api/server
  355. github.com/sspencer/imaginary
  356. github.com/steenzout/echo/examples/website
  357. github.com/stellar/go/services/federation
  358. github.com/stellar/horizon/src/github.com/stellar/horizon
  359. github.com/steveoc64/cycle2u2016
  360. github.com/steveoc64/godev/echocors
  361. github.com/steveoc64/itrak.mmaint
  362. github.com/stevepartridge/baseballga.me-server-go
  363. github.com/stinkyfingers/AuthApi
  364. github.com/stinkyfingers/GoBase
  365. github.com/svdberg/GCM-Thrift
  366. github.com/swisstxt/netmgmt
  367. github.com/synapse-garden/mf-proto
  368. github.com/synapse-garden/simple-reg
  369. github.com/threez/sophos-utm9/restd
  370. github.com/tischda/hugo-search
  371. github.com/tswindell/go-ethereum/rpc
  372. github.com/turtlemonvh/blanket-api/server
  373. github.com/ulule/ipfix/application
  374. github.com/unitrans/unitrans/src/scenario
  375. github.com/urakozz/transpoint.io/src/scenario
  376. github.com/urjitbhatia/gcm-playground/server
  377. github.com/uttamgandhi24/negroni-sample
  378. github.com/valiknet18/WebSocketChat
  379. github.com/verdverm/pomopomo/www
  380. github.com/vicever/apihub/gateway/middleware
  381. github.com/vinxi/cors
  382. github.com/vishwasnavadak/minio
  383. github.com/vjscjp/api4/core/server
  384. github.com/wangjohn/mutombo
  385. github.com/wangtuanjie/picfit/application
  386. github.com/whatisgravity/go-ethereum/rpc
  387. github.com/willnix/webchan
  388. github.com/wkrause13/apretasteconnect
  389. github.com/wkrause13/go-auth-starter
  390. github.com/xlab-si/e2ee-server
  391. github.com/xogeny/cors/examples/alice
  392. github.com/xogeny/cors/examples/default
  393. github.com/xogeny/cors/examples/goji
  394. github.com/xogeny/cors/examples/martini
  395. github.com/xogeny/cors/examples/negroni
  396. github.com/xogeny/cors/examples/nethttp
  397. github.com/xogeny/cors/examples/openbar
  398. github.com/yanfali/gensend-go
  399. github.com/yanfali/rest-layer/examples/cors
  400. github.com/yanfali/rest-layer/examples/demo
  401. github.com/yangsibai/panda
  402. github.com/yep/go-ethereum/rpc
  403. github.com/yuriadams/shorter
  404. github.com/zJeremiah/echo/examples/website
  405. gopkg.in/maklesoft/padlock-cloud.v1/padlockcloud

Imported only in test by 15 package(s)

  1. github.com/apuigsech/rest-layer
  2. github.com/apuigsech/rest-layer/rest
  3. github.com/awakenetworks/rest-layer
  4. github.com/awakenetworks/rest-layer/rest
  5. github.com/cmorent/rest-layer-datastore
  6. github.com/cmorent/rest-layer-mongo
  7. github.com/ianwalter/banter
  8. github.com/jxstanford/rest-layer-sqlite3
  9. github.com/rs/rest-layer
  10. github.com/rs/rest-layer-mongo
  11. github.com/rs/rest-layer/rest
  12. github.com/rs/xhandler
  13. github.com/smyrman/rest-layer
  14. github.com/yanfali/rest-layer
  15. github.com/yanfali/rest-layer/rest

Imports 2 package(s)

  1. github.com/rs/xhandler
  2. golang.org/x/net/context