Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add CORS support #7

Open
peterstadler opened this issue Sep 9, 2019 · 4 comments
Open

add CORS support #7

peterstadler opened this issue Sep 9, 2019 · 4 comments
Assignees

Comments

@peterstadler
Copy link
Member

We should provide CORS support to facilitate cross-domain requests (see e.g. https://www.html5rocks.com/en/tutorials/cors/).

For Jenkins there exists a Cors Filter Plugin which is currently enabled at the Paderborn Jenkins with the following settings:

* Access-Control-Allow-Origins: *
* Access-Control-Allow-Methods: POST, GET, OPTIONS
* Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type
* Access-Control-Expose-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type
* Access-Control-Max-Age: 999

This setup needs to be (discussed and) added to the Docker image.

@peterstadler peterstadler self-assigned this Sep 9, 2019
peterstadler added a commit that referenced this issue Sep 10, 2019
@peterstadler
Copy link
Member Author

I just added the CORS-filter-plugin to the list of plugins that get installed automatically. Yet I have not found a way to add the configuration so one still needs to edit those lines once for a fresh install.

Maybe "Jenkins Configuration as Code" is the way to go? (see https://github.com/jenkinsci/jep/blob/master/jep/201/README.adoc and https://automatingguy.com/2018/09/25/jenkins-configuration-as-code/)

@martindholmes
Copy link
Contributor

In the Jenkins root folder is this file:

org.jenkinsci.plugins.corsfilter.AccessControlsFilter.xml

which contains those settings. We could just add that to the Docker image.

@peterstadler
Copy link
Member Author

peterstadler commented Sep 10, 2019

I tried it but to no avail :(
(even with rereading the configuration from disk)

@martindholmes
Copy link
Contributor

That's a surprise! If you install the plugin, restart Jenkins, put the config file in place and restart Jenkins again, does it still fail? That's some weird voodoo. There must be some other setting hiding somewhere that has to be turned on to tell it to read the config file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants