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

nginx config for static files #4014

Open
TobiX opened this issue Dec 9, 2020 · 4 comments · May be fixed by #6308
Open

nginx config for static files #4014

TobiX opened this issue Dec 9, 2020 · 4 comments · May be fixed by #6308
Labels
documentation Jenkins documentation, including user and developer docs, solution pages, etc.

Comments

@TobiX
Copy link
Contributor

TobiX commented Dec 9, 2020

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

@TobiX TobiX added the documentation Jenkins documentation, including user and developer docs, solution pages, etc. label Dec 9, 2020
@artjomsmorscakovs
Copy link

artjomsmorscakovs commented Apr 19, 2023

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; }

@lemeurherve
Copy link
Member

@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 added a commit to artjomsmorscakovs/jenkins.io that referenced this issue Apr 19, 2023
jenkins-infra#4014

There is a typo in this reg expression, the backslashes need to be added for this regex to be valid, instead of this: '/static/' into this: '\/static\/' in both places
@artjomsmorscakovs
Copy link

@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

@lemeurherve lemeurherve linked a pull request Apr 19, 2023 that will close this issue
@TobiX
Copy link
Contributor Author

TobiX commented Apr 19, 2023

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...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Jenkins documentation, including user and developer docs, solution pages, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants