Getting 403, when try to Build a Job

Hi All,
Recently we have migrated to 2.440.1 LTS version of Jenkins. Update all the required plugin to fulfill the compatibility. But we are facing several issue to execute our freestyle and pipeline jobs.

It throws 403 for any type of POST request. I have fixed one place where it shows the content type set was text/plain at hudson-behaviour.json file.

I have changed headers: crumb.wrap({}), to headers: crumb.wrap({
“Content-Type”: “application/x-www-form-urlencoded”,
}),

and it is working. But at build now option, it asked to changed at configurable.js file. But i am unable to find this file under jenkins folder or Jenkins home folder. Please help me to resolve this issue. If you required any more info, please let me know.

You shouldn’t need to modify any files in order to be able to run jobs.
If this doesn’t work that would mean there is a severe bug in Jenkins. Using 2.440.1 myself and all works fine without issues.
403 normally means that you lack permission to run the job.

Which version of Jenkins did you use before?

Do you see this behaviour when triggering jobs via UI or via rest api? If via rest api, are you using a user with token or user with password.

Which line in hudson-behaviour.js did you change?
Do you have this problem for jobs with parameters or jobs without parameters?

Looks a bit like https://issues.jenkins.io/browse/JENKINS-72755

Hi Markus,
Thank you for reply on this.
I have migrated from 2.387.1 version to 2.440.1.
When i add a parameter to job, then it is working fine. I mean Build with Parameter is working fine.

In hudson-behaviour.js i have make the following changes:
At line no 2092 : make headers: crumb.wrap({}), To
headers: crumb.wrap({
** “Content-Type”: “application/x-www-form-urlencoded”,**
** }),**

I have problem with jobs without parameters. Job with parameter is working fine.
Please suggest.

The line you changed should not have an effect whether the job can be built. The method it is in (refreshPart) is there to update the sidepanel widgets (build history).

Anything logged in the browser console?

In the browser try to set a break point at /adjuncts/(random string)/lib/hudson/project/configurable/configurable.js line 7 and /adjuncts/(random string)/lib/layout/task/task.js line 12 and if it doesn’t get there in line 2

Then reload the page and try to build.

You are right Markus. The change I have done in hudson-behaviour.json is only for build history.
I have made the similar changes in configurable.js and task.js using chrome dev tool. And it works perfectly. But I am unable to find configurable.js file to make this changes permanently. Can you help me on this.

The 2 files are adjuncts that means they are inside the jar file of jenkins-core.
And modifying things in the FS is not really sustainable. The next jenkins update will require that you repeat your changes.

Still strange that you run into this problem. I would expect that only when the job has parameters that you need to set the Content-Type.
Do you see this problem on all jobs without parameters or only for some of them?

Maybe some plugin implicitly adds parameters that are not visible?

Currently I face this issue only with Job without Parameter. Also, i observed the same issue when try to stop any running job (app.js).

  1. Job without Parameter ( configurable.js)
  2. Rebuild any job ( task.js)
  3. Stop any job (app.js)

Can you create a new freestyle job that does nothing. Just create and save without configuring anything. Then click on Build Now
And post the created config.xml here please
Do the same with a pipeline job.

Also can you please provide a list of all plugins with version that you have installed

config.zip (1.5 KB)
Hi Markus,
I have uploaded the zip file contains both type of config files.

Here is the list of installed plugins with name and version

Name ↓ Version
Ant Plugin 1.13
Apache HttpComponents Client 4.x API Plugin 4.5.14-208.v438351942757
Authentication Tokens API Plugin 1.53.v1c90fd9191a_b_
Bootstrap 4 API Plugin 4.6.0-3
Bootstrap 5 API Plugin 5.3.2-3
bouncycastle API Plugin 2.30.1.77-225.v26ea_c9455fd9
Branch API Plugin 2.1128.v717130d4f816
Build Timeout 1.2
Build Timestamp Plugin 1.0.3
build user vars plugin 1.8
Caffeine API Plugin 3.1.8-133.v17b_1ff2e0599
Checks API plugin 2.0.2
Command Agent Launcher Plugin 107.v773860566e2e
commons-lang3 v3.x Jenkins API Plugin 3.13.0-62.v7d18e55f51e2
commons-text API Plugin 1.11.0-95.v22a_d30ee5d36
Config File Provider Plugin 968.ve1ca_eb_913f8c
Credentials Binding Plugin 657.v2b_19db_7d6e6d
Credentials Plugin 1319.v7eb_51b_3a_c97b_
Dark Theme 156.v6cf16af6f9ef
DataTables.net API Plugin 1.13.6-5
Date Parameter Plugin 0.0.4
Delivery Pipeline Plugin 1.4.2
Display URL API 2.200.vb_9327d658781
Docker Commons Plugin 439.va_3cb_0a_6a_fb_29
Docker Pipeline 572.v950f58993843
Durable Task Plugin 550.v0930093c4b_a_6
ECharts API Plugin 5.4.0-7
Email Extension Plugin 2.104
Folders Plugin 6.858.v898218f3609d
Font Awesome API Plugin 6.5.1-2
Git client plugin 4.6.0
Git plugin 5.2.1
GitHub API Plugin 1.318-461.v7a_c09c9fa_d63
GitHub Branch Source Plugin 2.11.4
GitHub plugin 1.38.0
GitLab API Plugin 5.3.0-91.v1f9a_fda_d654f
GitLab Authentication plugin 1.19
Google Login Plugin 109.v022b_cf87b_e5b_
Gradle Daemon saver 0.1.0
Gradle Plugin 1.37.1
Gradle Repo plugin 1.0.1
Gson API Plugin 2.10.1-15.v0d99f670e0a_7
Instance Identity 185.v303dc7c645f9
Ionicons API 56.v1b_1c8c49374e
Jackson 2 API Plugin 2.16.1-373.ve709c6871598
Jakarta Activation API 2.0.1-3
Jakarta Mail API 2.0.1-3
Java JSON Web Token (JJWT) Plugin 0.11.5-77.v646c772fddb_0
JavaBeans Activation Framework (JAF) API 1.2.0-6
JavaMail API 1.6.2-9
JavaScript GUI Lib: ACE Editor bundle plugin 1.1
JavaScript GUI Lib: Handlebars bundle plugin 3.0.8
JavaScript GUI Lib: Moment.js bundle plugin 1.1.1
JAXB plugin 2.3.9-1
Jersey 2 API 2.40-1
Joda Time API Plugin 2.12.7-29.v5a_b_e3a_82269a_
jQuery plugin 1.12.4-1
JQuery3 API Plugin 3.7.1-1
JSch dependency plugin 0.2.16-86.v42e010d9484b_
JSON Path API Plugin 2.9.0-33.v2527142f2e1d
JUnit Plugin 1259.v65ffcef24a_88
LDAP Plugin 682.v7b_544c9d1512
Lockable Resources plugin 1243.v346d600eea_24
Mailer Plugin 463.vedf8358e006b_
Mask Passwords Plugin 3.3
Material Theme 0.4.1
Matrix Authorization Strategy Plugin 3.2.1
Matrix Project Plugin 822.824.v14451b_c0fd42
MFA/Two-Factor-Authentication(2FA) 1.0.3
Mina SSHD API :: Common 2.12.0-90.v9f7fb_9fa_3d3b_
Mina SSHD API :: Core 2.12.0-90.v9f7fb_9fa_3d3b_
Node and Label parameter plugin 1.12.0
OkHttp Plugin 4.11.0-172.vda_da_1feeb_c6e
Oracle Java SE Development Kit Installer Plugin 73.vddf737284550
OWASP Markup Formatter Plugin 155.v795fb_8702324
PAM Authentication plugin 1.6.1
Parameterized Trigger plugin 787.v665fcf2a_830b_
Pipeline 596.v8c21c963d92d
Pipeline Graph Analysis Plugin 202.va_d268e64deb_3
Pipeline: API 1291.v51fd2a_625da_7
Pipeline: Basic Steps 1042.ve7b_140c4a_e0c
Pipeline: Build Step 540.vb_e8849e1a_b_d8
Pipeline: Declarative 2.2175.v76a_fff0a_2618
Pipeline: Declarative Extension Points API 2.2175.v76a_fff0a_2618
Pipeline: Groovy 3867.v535458ce43fd
Pipeline: Groovy Libraries 704.vc58b_8890a_384
Pipeline: Input Step 491.vb_07d21da_1a_fb_
Pipeline: Job 1400.v7fd111b_ec82f
Pipeline: Milestone Step 111.v449306f708b_7
Pipeline: Model API 2.2175.v76a_fff0a_2618
Pipeline: Multibranch 773.vc4fe1378f1d5
Pipeline: Nodes and Processes 1331.vc8c2fed35334
Pipeline: REST API Plugin 2.34
Pipeline: SCM Step 415.v434365564324
Pipeline: Stage Step 305.ve96d0205c1c6
Pipeline: Stage Tags Metadata 2.2175.v76a_fff0a_2618
Pipeline: Stage View Plugin 2.34
Pipeline: Step API 657.v03b_e8115821b_
Pipeline: Supporting APIs 865.v43e78cc44e0d
Plain Credentials Plugin 143.v1b_df8b_d3b_e48
Plugin Utilities API Plugin 3.8.0
Popper.js 2 API Plugin 2.11.6-2
Popper.js API Plugin 1.16.1-2
Rebuilder 330.v645b_7df10e2a_
Resource Disposer Plugin 0.17
Role-based Authorization Strategy 633.v836e5b_3e80a_5
Safe Restart Plugin 0.7
SCM API Plugin 683.vb_16722fb_b_80b_
Script Security Plugin 1326.vdb_c154de8669
Simple Theme Plugin 103.va_161d09c38c7
SnakeYAML API Plugin 2.2-111.vc6598e30cc65
Solarized Theme Plugin 0.1
SonarQube Scanner for Jenkins 2.14
SSH Build Agents plugin 1.33.0
SSH Credentials Plugin 308.ve4497b_ccd8f4
SSH Pipeline Steps 2.0.68.va_d21a_12a_6476
SSH server 3.322.v159e91f6a_550
Structs Plugin 337.v1b_04ea_4df7c8
Theme Manager 192.v43b_71661283b_
ThinBackup 1.1
Timestamper 1.15
Token Macro Plugin 400.v35420b_922dcb_
Trilead API Plugin 2.84.v72119de229b_7
Variant Plugin 60.v7290fc0eb_b_cd
Workspace Cleanup Plugin 0.4

I setup a jenkins with all the mentioned plugin (but in latest version) and everything works as expected.
As you don’t have latest plugin version please update all plugins to the latest version.

These 3 plugins are not required anymore and should be uninstalled:
JavaScript GUI Lib: ACE Editor bundle plugin
JavaScript GUI Lib: Handlebars bundle plugin
JavaScript GUI Lib: Moment.js bundle plugin

Some plugins can be uninstalled because only one of them can be used:
e.g from the following only one is required
Google Login
LDAP
PAM Authentication
Gitlab Authentication

Same for
Matrix authorization
Role Strategy

Unused plugins:
bootstrap 4 API
poppers.js 2 api
poppers.js api (after uninstalling bootstrap 4)

Hi Markus,

Thank you for reply on this. As per your suggestion, I have uninstalled/update plugins. But issue is still there. I am not able to build a job without parameter and not able to stop it.

One thing I want to inform you that it is working fine at localhost. We have deployed at server and access it through https, it fails on both places.

Here is the updated status of plugins:

Name ↓ Version
Ant Plugin 1.13
Apache HttpComponents Client 4.x API Plugin 4.5.14-208.v438351942757
Authentication Tokens API Plugin 1.53.v1c90fd9191a_b_
Bootstrap 5 API Plugin 5.3.2-4
bouncycastle API Plugin 2.30.1.77-225.v26ea_c9455fd9
Branch API Plugin 2.1152.v6f101e97dd77
Build Timeout 1.32
Build Timestamp Plugin 1.0.3
build user vars plugin 1.9
Caffeine API Plugin 3.1.8-133.v17b_1ff2e0599
Checks API plugin 2.0.2
Command Agent Launcher Plugin 107.v773860566e2e
commons-lang3 v3.x Jenkins API Plugin 3.13.0-62.v7d18e55f51e2
commons-text API Plugin 1.11.0-95.v22a_d30ee5d36
Config File Provider Plugin 968.ve1ca_eb_913f8c
Credentials Binding Plugin 657.v2b_19db_7d6e6d
Credentials Plugin 1337.v60b_d7b_c7b_c9f
Dark Theme 439.vdef09f81f85e
DataTables.net API Plugin 1.13.8-4
Date Parameter Plugin 0.0.4
Delivery Pipeline Plugin 1.4.2
Display URL API 2.200.vb_9327d658781
Docker Commons Plugin 439.va_3cb_0a_6a_fb_29
Docker Pipeline 572.v950f58993843
Durable Task Plugin 550.v0930093c4b_a_6
ECharts API Plugin 5.4.3-4
Email Extension Plugin 2.105
Folders Plugin 6.901.vb_4c7a_da_75da_3
Font Awesome API Plugin 6.5.1-3
Git client plugin 4.6.0
Git plugin 5.2.1
GitHub API Plugin 1.318-461.v7a_c09c9fa_d63
GitHub Branch Source Plugin 1772.va_69eda_d018d4
GitHub plugin 1.38.0
GitLab API Plugin 5.3.0-91.v1f9a_fda_d654f
Gradle Daemon saver 0.1.0
Gradle Plugin 2.1
Gradle Repo plugin 1.0.1
Gson API Plugin 2.10.1-15.v0d99f670e0a_7
Instance Identity 185.v303dc7c645f9
Ionicons API 56.v1b_1c8c49374e
Jackson 2 API Plugin 2.16.1-373.ve709c6871598
Jakarta Activation API 2.1.3-1
Jakarta Mail API 2.1.3-1
Java JSON Web Token (JJWT) Plugin 0.11.5-77.v646c772fddb_0
JavaBeans Activation Framework (JAF) API 1.2.0-6
JavaMail API 1.6.2-9
JAXB plugin 2.3.9-1
Jersey 2 API 2.41-133.va_03323b_a_1396
Joda Time API Plugin 2.12.7-29.v5a_b_e3a_82269a_
jQuery plugin 1.12.4-1
JQuery3 API Plugin 3.7.1-2
JSch dependency plugin 0.2.16-86.v42e010d9484b_
JSON Path API Plugin 2.9.0-33.v2527142f2e1d
JUnit Plugin 1259.v65ffcef24a_88
LDAP Plugin 711.vb_d1a_491714dc
Lockable Resources plugin 1243.v346d600eea_24
Mailer Plugin 470.vc91f60c5d8e2
Mask Passwords Plugin 173.v6a_077a_291eb_5
Material Theme 0.5.2-rc100.6121925fe229
Matrix Project Plugin 822.824.v14451b_c0fd42
MFA/Two-Factor-Authentication(2FA) 1.0.4
Mina SSHD API :: Common 2.12.0-90.v9f7fb_9fa_3d3b_
Mina SSHD API :: Core 2.12.0-90.v9f7fb_9fa_3d3b_
Node and Label parameter plugin 1.12.0
OkHttp Plugin 4.11.0-172.vda_da_1feeb_c6e
Oracle Java SE Development Kit Installer Plugin 73.vddf737284550
OWASP Markup Formatter Plugin 162.v0e6ec0fcfcf6
Parameterized Trigger plugin 787.v665fcf2a_830b_
Pipeline 596.v8c21c963d92d
Pipeline Graph Analysis Plugin 216.vfd8b_ece330ca_
Pipeline: API 1291.v51fd2a_625da_7
Pipeline: Basic Steps 1049.v257a_e6b_30fb_d
Pipeline: Build Step 540.vb_e8849e1a_b_d8
Pipeline: Declarative 2.2175.v76a_fff0a_2618
Pipeline: Declarative Extension Points API 2.2175.v76a_fff0a_2618
Pipeline: Groovy 3880.vb_ef4b_5cfd270
Pipeline: Groovy Libraries 704.vc58b_8890a_384
Pipeline: Input Step 491.vb_07d21da_1a_fb_
Pipeline: Job 1400.v7fd111b_ec82f
Pipeline: Milestone Step 111.v449306f708b_7
Pipeline: Model API 2.2175.v76a_fff0a_2618
Pipeline: Multibranch 773.vc4fe1378f1d5
Pipeline: Nodes and Processes 1331.vc8c2fed35334
Pipeline: REST API Plugin 2.34
Pipeline: SCM Step 415.v434365564324
Pipeline: Stage Step 305.ve96d0205c1c6
Pipeline: Stage Tags Metadata 2.2175.v76a_fff0a_2618
Pipeline: Stage View Plugin 2.34
Pipeline: Step API 657.v03b_e8115821b_
Pipeline: Supporting APIs 865.v43e78cc44e0d
Plain Credentials Plugin 179.vc5cb_98f6db_38
Plugin Utilities API Plugin 4.1.0
Rebuilder 330.v645b_7df10e2a_
Resource Disposer Plugin 0.23
Role-based Authorization Strategy 711.vf33a_d2c994b_a_
Safe Restart Plugin 0.7
SCM API Plugin 683.vb_16722fb_b_80b_
Script Security Plugin 1326.vdb_c154de8669
Simple Theme Plugin 176.v39740c03a_a_f5
SnakeYAML API Plugin 2.2-111.vc6598e30cc65
Solarized Theme Plugin 0.1
SonarQube Scanner for Jenkins 2.17.2
SSH Build Agents plugin 2.948.vb_8050d697fec
SSH Credentials Plugin 322.v124df57ed808
SSH Pipeline Steps 2.0.68.va_d21a_12a_6476
SSH server 3.322.v159e91f6a_550
Structs Plugin 337.v1b_04ea_4df7c8
Theme Manager 215.vc1ff18d67920
ThinBackup 1.18
Timestamper 1.26
Token Macro Plugin 400.v35420b_922dcb_
Trilead API Plugin 2.133.vfb_8a_7b_9c5dd1
Variant Plugin 60.v7290fc0eb_b_cd
Workspace Cleanup Plugin 0.45

How are you running your Jenkins?
Have you installed the Jenkins package via package manager, are you using a docker container.
Do you have a reverse proxy in front that is doing the ssl termination?