Skip to content

Instantly share code, notes, and snippets.

Yuki Ito mururu

Block or report user

Report or block mururu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mururu
mururu / ca_cowboy_middleware.erl
Last active Mar 28, 2018 — forked from sebmaynard/ca_cowboy_middleware.erl
[For Cowboy 2.0] A Cowboy middleware to set some CORS headers for every request, and to handle OPTIONS requests without needing to implement them in every handler.
View ca_cowboy_middleware.erl
-module(ca_cowboy_middleware).
-behaviour(cowboy_middleware).
-export([execute/2]).
execute(Req, Env) ->
{ok, ReqWithCorsHeaders} = set_cors_headers(Req),
Method = cowboy_req:method(ReqWithCorsHeaders),
You can’t perform that action at this time.