jenkins.io
jenkins.io copied to clipboard
nginx config for static files
The nginx reverse proxy page contains this snippet:
location ~ "^/static/[0-9a-fA-F]{8}\/(.*)$" {
#rewrite all static files into requests to the root
#E.g /static/12345678/css/something.css will become /css/something.css
rewrite "^/static/[0-9a-fA-F]{8}\/(.*)" /$1 last;
}
But AFAIK this cannot work, since not all static artifacts are in that directory (for example, plugin artifacts). Should that be removed? Or is there another clever way to avoid hitting Jenkins for static artifacts?
Links
- https://github.com/jenkins-infra/jenkins.io/blob/master/content/doc/book/system-administration/reverse-proxy-configuration-nginx.adoc
There is a typo in this reexpression, the backslashes needs to be added for this regex to be valid, instead of this: /static/ into this: \/static\/ in both places
location ~ "^\/static\/[0-9a-fA-F]{8}\/(.*)$" { #rewrite all static files into requests to the root #E.g /static/12345678/css/something.css will become /css/something.css rewrite "^\/static\/[0-9a-fA-F]{8}\/(.*)" /$1 last; }
@artjomsmorscakovs good catch!
Would you like to open a pull request to fix the regexp in this page?
https://github.com/jenkins-infra/jenkins.io/edit/master/content/doc/book/system-administration/reverse-proxy-configuration-with-jenkins/reverse-proxy-configuration-nginx.adoc
@artjomsmorscakovs good catch!
Would you like to open a pull request to fix the regexp in this page?
https://github.com/jenkins-infra/jenkins.io/edit/master/content/doc/book/system-administration/reverse-proxy-configuration-with-jenkins/reverse-proxy-configuration-nginx.adoc
ok, done
Even with the typo fixed, this will break many Jenkins pages since not all "static" resources can be found in the "exploded" directory. That was the whole point I wanted to address with this issue. (So it's actually a good thing the regex was broken before...)