![]() tResourceBase("target/classes/api-docs") įinal ServletContextHandler swaggerUIContext = new ServletContextHandler() Here is how I am setting the CORS on server final ResourceHandler swaggerUIResourceHandler = new ResourceHandler() Origin Referer User-Agent Mozilla/5.0 (X11 Ubuntu Linux x86_64 rv:33.0) The Request and Response headers in firefox V33.0 are Response HeadersĪccept application/json charset=utf-8,*/* FilterHolder cors = swaggerUIContext.addFilter(CrossOriginFilter.class,"/*",EnumSet.of(DispatcherTyp e.REQUEST)) Ĭors.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "*") Ĭors.setInitParameter(CrossOriginFilter.ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, "") Ĭors.setInitParameter(CrossOriginFilter.ALLOWED_METHODS_PARAM, "GET,POST,HEAD") Ĭors.setInitParameter(CrossOriginFilter.ALLOWED_HEADERS_PARAM, "Content-Type, api_key, Authorization") I have added the CORS filter on API Documentation server (port 9000) as follows. I am trying to run Swagger UI on port say 9090 and the Swagger API documentation at 9000 and trying to display the documentation in the UI. ![]() ![]() It may not have theĪppropriate access-control-origin settings. Uncaught exception: Can't read from server. This can be fixed by moving the resource to the ![]() Unable to Load SwaggerUI /api-docs/ (line 83)Ĭross-Origin Request Blocked: The Same Origin Policy disallowsĭocs/service.json. Can someone tell me why am i getting these errors. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |