| We use the CORS plugin to be able to access jenkins content from an HTML REST Client. To receive status updates on our dashboard we use the Jenkins SSE Gateway plugin with the javascript client. The plugin doesn't use the CORS settings from the CORS plugin. So far we have forked the repo and hard coded cors like this in src\main\java\org\jenkinsci\plugins\ssegateway\Endpoint.java: public void doFilter(...)... String origin = httpServletRequest.getHeader("Origin"); httpServletResponse.addHeader("Access-Control-Allow-Credentials", "true"); httpServletResponse.setHeader("Access-Control-Allow-Origin", origin); httpServletResponse.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, HEAD"); httpServletResponse.setHeader("Access-Control-Allow-Headers", "X-PINGOTHER, LAST-EVENT-ID, Origin, X-Requested-With, Content-Type, Accept"); httpServletResponse.setHeader("Access-Control-Max-Age", "1728000"); Better would be to get the cors settings from the plugin: cors=Jenkins.instance.pluginManager.plugins.find {it.getShortName()=='cors-filter' } corsClass=AccessControlsFilter.classresp.addHeader("Access-Control-Allow-Methods", getDescriptor().getAllowedMethods()); However, I dont know about the performance implications of querying the cors plugin on every request. |