Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Feature request: allow setting allowed origin #214
I'm using the router for my RESTful JSON API, and intended to use the built-in options handler.
However, the built-in OPTIONS-handler is not aware of
This would be fine, as it's a simple method, except that you no longer know which methods have registered handlers, and since the
I prefer the first option, as I believe it simply completes the
You can implement this yourself pretty simply -- we have a "framework" that standardizes multiple routers to add router groups, upstream/downstream middleware, context, CORS support, etc -- and implemented this exact thing for several routers. Most of the routers provide a way for you to match a path/HTTP method so you can create your own list of allowed routes to respond to CORS/OPTIONS requests.. You can see an example that has been working well for us here: