Syncrify » Knowledge base

Document information

Document ID:5334
Subject:How to add custom headers in HTTP response
Creation date:1/2/20 11:15 AM
Last modified on:1/2/20 11:17 AM


Adding Custom Headers in HTTP Response

The method specified on this page applies to Syncrify and SynaMan

Companies often want to add custom headers in HTTP response to make the communication more secure.

There are two types of custom headers:

  • Hard-coded with a default value
  • User Defined

Hard-coded Headers

These headers are already present in the response but their presence can be overwritten by specifying a value in server.properties file. Following tables lists their name and default values:

Parameter in server.properties Header Name Header Value
use.strict.transport.security.4https Strict-Transport-Security max-age=86400
use.x-frame.options x-frame-options SAMEORIGIN
use.x-xss.protection X-XSS-Protection 1; mode=block
use.x-content.type.options X-Content-Type-Options nosniff
use.referrer-policy Referrer-Policy no-referrer
use.http.public.key.pins Public-Key-Pins Dynamically generated

Changing Values for Default Headers

Assume you want to change the value for the Referrer-Policy from no-referrer to origin. Add the following lines in server.properties file.
use.referrer-policy=false
Then, use the CustomHttpHeaders.txt file to specify the new value. (See below).

Adding User Defined Headers

  • Add a new text file called CustomHttpHeaders.txt in $INSTALL_DIR\config folder.
  • Every line in this file can hold a single pair of Header Name/Value. For example:
    Cache-Control: no-cache
  • Save the file
  • Restart Syncrify/SynaMan




Add a comment to this document

Do you have a helpful tip related to this document that you'd like to share with other users? Please add it below. Your name and tip will appear at the end of the document text.
Your name:
Your email:
Hide my email address
Verification code:
Enter the verification code you see above more submitting your tip
Tip:Please limit tips to 1000 characters

Navigation

Social Media

Powered by 10MinutesWeb.com