Fix: prevent custom headers from being cleared on save #590

Closed
opened 2026-04-05 17:24:23 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @PavanendraBaahubali on 11/28/2025

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

This PR fixes an issue where custom headers were being cleared when saving resource settings.
The values entered in the “Custom Headers” field were not persisted after editing authentication, general, or rules tabs.

Fix

  • Ensures custom header values are retained and correctly saved.
  • Prevents accidental loss of header data when updating resource settings.

The issue was that when saving settings from other tabs (General, Rules, Authentication), the request only included that tab’s data and didn’t include headers.

Previously we had:

let headers = null;
if (updateData.headers) {
  headers = JSON.stringify(updateData.headers);
}

So when updateData.headers was missing, headers stayed null and the DB overwrote existing custom headers with null.

I changed it to:

let headers = resource.headers;
if (updateData.headers) {
  headers = JSON.stringify(updateData.headers);
}

Now, if a request doesn’t include headers (e.g. saving General/Rules/Authentication only), we keep the existing resource.headers and no longer clear the custom headers.

Fixes #1885

Notes

Tested locally to confirm:

  • Custom headers persist after save
  • No clearing/resetting across tabs (authentication, general, rules)

How to test?

read this issue #1885

*Originally created by @PavanendraBaahubali on 11/28/2025* ## Community Contribution License Agreement By creating this pull request, I grant the project maintainers an unlimited, perpetual license to use, modify, and redistribute these contributions under any terms they choose, including both the AGPLv3 and the Fossorial Commercial license terms. I represent that I have the right to grant this license for all contributed content. ## Description This PR fixes an issue where **custom headers were being cleared when saving resource settings**. The values entered in the “Custom Headers” field were not persisted after editing authentication, general, or rules tabs. ### **Fix** * Ensures custom header values are retained and correctly saved. * Prevents accidental loss of header data when updating resource settings. --- The issue was that when saving settings from other tabs (General, Rules, Authentication), the request only included that tab’s data and **didn’t include `headers`**. Previously we had: ```ts let headers = null; if (updateData.headers) { headers = JSON.stringify(updateData.headers); } ``` So when `updateData.headers` was missing, `headers` stayed `null` and the DB overwrote existing custom headers with `null`. I changed it to: ```ts let headers = resource.headers; if (updateData.headers) { headers = JSON.stringify(updateData.headers); } ``` Now, if a request doesn’t include `headers` (e.g. saving General/Rules/Authentication only), we keep the existing `resource.headers` and no longer clear the custom headers. ### **Related Issue** Fixes **#1885** ### **Notes** Tested locally to confirm: * Custom headers persist after save * No clearing/resetting across tabs (authentication, general, rules) ## How to test? read this issue **#1885**
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/pangolin#590