Jenkins Resource Root URL not working (404) with Project-based matrix auth

Running Jenkins on dedicated machine, with SSL provided by Haproxy.

Jenkins runs inside internal network, with URL https://jenkins.company.com , https://jenkins-static.company.com is set up to point to the same machine.

Haproxy settings as from jenkins tutorial (disabling haproxy and switching to direct HTTP does not solve the issue).

When setting up Resource Root URL using “Manage Jenkins >> System”, all artifacts URL are converted to https://jenkins-static.company.com/static-files/TOKEN/FILE_PATH but trying to open the link always leads to “Oops!” 404 page.

I was unable to find any related information in the logs.

To make Resource URL work I had to add “Job/Read” permission to “Authenticated Users” in global settings for Project-based Matrix Authorization Strategy. But this breaks the security of my Jenkins instance, so this solution can’t be applied.

I’ve tried playing with some jenkins properties related to Resource URL:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Environment="JENKINS_OPTS=-Djenkins.security.ResourceDomainRootAction.allowAuthenticatedUser=true"
Environment="JENKINS_OPTS=-Djenkins.security.ResourceDomainRootAction.validForMinutes=30"
</code>
<code>Environment="JENKINS_OPTS=-Djenkins.security.ResourceDomainRootAction.allowAuthenticatedUser=true" Environment="JENKINS_OPTS=-Djenkins.security.ResourceDomainRootAction.validForMinutes=30" </code>
Environment="JENKINS_OPTS=-Djenkins.security.ResourceDomainRootAction.allowAuthenticatedUser=true"
Environment="JENKINS_OPTS=-Djenkins.security.ResourceDomainRootAction.validForMinutes=30"

but without any change.

More findings – if instead of “Job/Read” I set only “Job/Discover” I get 403 instead of 404

1

1.Double-check Resource Root URL configuration in Jenkins.

2.Review HAProxy configuration to properly handle static files.

3.Ensure correct file permissions for static assets.

4.Examine Jenkins and HAProxy logs for 404 or token-related errors.

5.Verify OAuth plugin settings and check if disabling it resolves the issue.

6.Review CORS policies for cross-domain access from jenkins-static.company.com.

If none of these solutions work, try isolating the issue further by serving static files without HAProxy or using a different reverse proxy to see if the problem persists.

Edited:
From configuration help of Resource Root URL, the URL

Resource URLs do not require authentication (users will not have a valid session for the resource root URL). Sharing a resource URL with another user, even one lacking Overall/Read permission for Jenkins, will grant that user access to these files until the URLs expire.

Authentication – User Content in Jenkins Documentation

Brings to thought the question of when exactly are you trying to access the URL itself – is it after the expiration period?

Resource URLs expire after 30 minutes by default. Expired resource URLs will redirect users to their equivalent Jenkins URLs, so that the user can reauthenticate, if necessary, and then be redirected back to a new resource URL that will be valid for another 30 minutes.

Expiration – User Content in Jenkins Documentation

If the attempted access is well before 30 minutes, could be that the expiry is configured to be short or none:

To change how quickly resource URLs expire, set the system property jenkins.security.ResourceDomainRootAction.validForMinutes to the desired value in minutes.

Expiration – User Content in Jenkins Documentation

Lastly, I can see that in recent versions (my test instance is old – 2.332.1) there have been an added parameter, which I’ve yet to find any additional documentation on, and which only explanation is ‘escape hatch for a security improvement’ – perhaps it’s related to the behavior:

jenkins.security.ResourceDomainRootAction.allowAuthenticatedUser
Since: 2.475
Default: false
Description: Allow authenticated user access to Resource URLs. Escape hatch for a security improvement related to the 2024-01-24 security advisory.

System Properties in Jenkins Documentation

7

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật