{"action":"closed","issue":{"url":"https://api.github.com/repos/emicklei/go-restful/issues/183","labels_url":"https://api.github.com/repos/emicklei/go-restful/issues/183/labels{/name}","comments_url":"https://api.github.com/repos/emicklei/go-restful/issues/183/comments","events_url":"https://api.github.com/repos/emicklei/go-restful/issues/183/events","html_url":"https://github.com/emicklei/go-restful/issues/183","id":58982142,"number":183,"title":"Keep getting no route for HTTP OPTIONS","user":{"login":"moserke","id":1779323,"avatar_url":"https://avatars.githubusercontent.com/u/1779323?v=3","gravatar_id":"","url":"https://api.github.com/users/moserke","html_url":"https://github.com/moserke","followers_url":"https://api.github.com/users/moserke/followers","following_url":"https://api.github.com/users/moserke/following{/other_user}","gists_url":"https://api.github.com/users/moserke/gists{/gist_id}","starred_url":"https://api.github.com/users/moserke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moserke/subscriptions","organizations_url":"https://api.github.com/users/moserke/orgs","repos_url":"https://api.github.com/users/moserke/repos","events_url":"https://api.github.com/users/moserke/events{/privacy}","received_events_url":"https://api.github.com/users/moserke/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-02-25T22:41:49Z","updated_at":"2015-03-09T09:06:10Z","closed_at":"2015-03-09T09:06:10Z","body":"I have tried everything and I keep getting \"[restful] 2015/02/25 14:30:58 jsr311.go:53: no Route found (in 1 routes) that matches HTTP method OPTIONS\" when trying to do CORS.\r\n\r\nIt is only when I am trying to use the basicAuth filter, it's like the Options filter doesn't like getting an Authorization header and so does not return back the Allowed actions, I am not sure how to fix it.  Have tried many things.  Below is the relatively simple API that should be working.\r\n\r\n```\r\npackage main\r\n\r\nimport (\r\n  \"github.com/emicklei/go-restful\"\r\n  \"github.com/emicklei/go-restful/swagger\"\r\n  \"io\"\r\n  \"log\"\r\n  \"net/http\"\r\n  \"os\"\r\n)\r\n\r\ntype UserResource struct{}\r\n\r\nfunc (u UserResource) RegisterTo(container *restful.Container) {\r\n  ws := new(restful.WebService)\r\n  ws.\r\n    Path(\"/users\").\r\n    Consumes(restful.MIME_JSON).\r\n    Produces(restful.MIME_JSON).\r\n    Doc(\"Fake Service\").\r\n    Documentation()\r\n\r\n  param := ws.PathParameter(\"user\", \"user id\").DataType(\"string\")\r\n\r\n  ws.Route(ws.\r\n    GET(\"{user-id}\").\r\n    Filter(basicAuth).\r\n    To(u.nop).\r\n    Doc(\"Gets user id\").\r\n    Operation(\"getUser\").\r\n    Writes(UserResource{}).\r\n    Param(param))\r\n\r\n  container.Add(ws)\r\n}\r\n\r\nfunc basicAuth(request *restful.Request, response *restful.Response, chain *restful.FilterChain) {\r\n  _, _, ok := request.Request.BasicAuth()\r\n  if !ok {\r\n    response.AddHeader(\"WWW-Authenticate\", `Basic realm=\"nordstrom.net\"`)\r\n    response.WriteErrorString(401, \"401: Not Authorized\")\r\n    return\r\n  }\r\n  chain.ProcessFilter(request, response)\r\n}\r\n\r\nfunc (u UserResource) nop(request *restful.Request, response *restful.Response) {\r\n  io.WriteString(response.ResponseWriter, \"this would be a normal response\")\r\n}\r\n\r\nfunc main() {\r\n  wsContainer := restful.NewContainer()\r\n  wsContainer.Filter(wsContainer.OPTIONSFilter)\r\n  restful.TraceLogger(log.New(os.Stdout, \"[restful] \", log.LstdFlags|log.Lshortfile))\r\n\r\n  u := UserResource{}\r\n  u.RegisterTo(wsContainer)\r\n\r\n  config := swagger.Config{\r\n      WebServices:    wsContainer.RegisteredWebServices(),\r\n      ApiPath:        \"/swagger.json\"}\r\n  swagger.RegisterSwaggerService(config, wsContainer)\r\n\r\n  cors := restful.CrossOriginResourceSharing{\r\n    AllowedHeaders: []string{\"Accept\", \"Authorization\"},\r\n    AllowedMethods: []string{\"GET\"},\r\n    CookiesAllowed: false,\r\n    Container:      wsContainer}\r\n\r\n  wsContainer.Filter(wsContainer.OPTIONSFilter)\r\n  wsContainer.Filter(cors.Filter)\r\n\r\n  log.Printf(\"start listening on localhost:8080\")\r\n  server := &http.Server{Addr: \":8080\", Handler: wsContainer}\r\n  log.Fatal(server.ListenAndServe())\r\n}\r\n```\r\n\r\nAny help would be greatly appreciated."}}