Try our conversational search powered by Generative AI!

Cannot set header for a StaticFile

Fixed in

EPiServer.Forms 5.6.1

(Or a related package)

Created

Aug 07, 2023

Updated

Sep 18, 2023

State

Closed, Fixed and tested


Description

Fixed an issue that prevented you from setting a header for StaticFile.

Added the following option to the Forms section in appsettings.json.

"Forms": {
  "FormsConfigOptions": {
    "StaticFilesHeaders": {
      "Strict-Transport-Security": "max-age=63072000; includeSubDomains; preload"
    }
  } 
}

To test this:

  1. Show a page that has a form.
  2. Press F12.
  3. Open the Network tab.
  4. Verify that the  /Util/Episerver.Forms/EpiserverForms.js and /Util/Episerver.Forms/jquery-3.5.1.min.js URLs have a header:

"Strict-Transport-Security": "max-age=63072000; includeSubDomains; preload"