How to add security headers to Alloy Navigator web apps
On this page
HTTP security headers for the Web App, the Self Service Portal, and the API
are added to the configuration of the IIS site that hosts them. An
administrator of the web server finds that site with the Web Configuration
tool, adds the first header in IIS Manager, which creates the site's
web.config file, and adds the remaining headers in that file.
Before you begin
- The applications as shipped send none of the headers below, and the Web
Configuration tool does not add them. The one exception is the Web App's
response to a download of a local file, which carries
X-Content-Type-Options: nosniffandStrict-Transport-Security: max-age=31536000; includeSubDomains. - The web applications are published as instances with the Web Configuration tool; see Publish the Web Applications.
- To save your changes to the
web.configfile, you may need to run your text editor as administrator.
Find the site that hosts the web applications
In the Web Configuration tool:
- In the tree, select a Web App, Self Service Portal, or API instance. The
tree lists each IIS site that has an
httporhttpsbinding as a node named after the site, with each published application under it. - On the instance's information page, read the Site line of the Web category. This is the site you add the headers to. The Physical path value is a link that opens the instance's folder in File Explorer.
- Choose File > IIS Management > Start IIS Manager.
Choose the headers
The headers and values below have been tested for use with the web applications:
| Header | Value |
|---|---|
Expect-CT |
enforce, max-age=43200 |
Content-Security-Policy |
default-src *; style-src 'self' http://* 'unsafe-inline'; script-src 'self' http://* 'unsafe-inline' 'unsafe-eval'; img-src 'self' http://* data:; |
Feature-Policy |
fullscreen 'none' |
Permissions-Policy |
fullscreen=() |
Referrer-Policy |
no-referrer |
Strict-Transport-Security |
max-age=31536000; includeSubDomains; preload |
X-Content-Type-Options |
nosniff |
X-Frame-Options |
SAMEORIGIN |
X-XSS-Protection |
1; mode=block |
For other values or other headers, contact Alloy Software Support.
NOTE: Some of the headers may not be supported by the web browsers that your employees and customers use. Check browser compatibility before you add them.
Add the first header in IIS Manager
Adding a header in IIS Manager creates the site's web.config file when
it does not exist yet, together with its <customHeaders> section.
- In IIS Manager, expand the server node and Sites, and select the site that hosts the Alloy web applications, typically Alloy Navigator Site.
- Open HTTP Response Headers.
- In the Actions pane, click Add.
- In Add Custom HTTP Header, type the header's Name and Value,
and click OK. For example, type
Expect-CTas the name andenforce, max-age=43200as the value.
You can add every header this way. To add the rest at once, continue in the
web.config file.
Add the remaining headers in the web.config file
- In IIS Manager, right-click the site that hosts the Alloy web
applications, click Explore, and open the site's
web.configfile in a text editor. - Add or edit the
<customHeaders>section, above the closing</configuration>tag, with one entry for each header and its value. - Save the file.
With all the headers from the table, the entries of the <customHeaders>
section read:
<customHeaders>
<add name="Expect-CT" value="enforce, max-age=43200" />
<add name="Content-Security-Policy" value="default-src *; style-src 'self' http://* 'unsafe-inline'; script-src 'self' http://* 'unsafe-inline' 'unsafe-eval'; img-src 'self' http://* data:;" />
<add name="Feature-Policy" value="fullscreen 'none'" />
<add name="Permissions-Policy" value="fullscreen=()" />
<add name="Referrer-Policy" value="no-referrer" />
<add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains; preload" />
<add name="X-Content-Type-Options" value="nosniff" />
<add name="X-Frame-Options" value="SAMEORIGIN" />
<add name="X-XSS-Protection" value="1; mode=block" />
</customHeaders>
Restart IIS
Restart IIS to apply the changes. Use either application:
- In the Web Configuration tool, choose File > IIS Management > Restart IIS.
- In IIS Manager, select the server node, and then click Restart in the Actions pane.
Keep the headers across an upgrade
An upgrade of the web applications replaces their files. Across an upgrade,
hand-made edits to an instance's Web.config, such as added
<customHeaders>, are replaced with the new files. Only the part between
the two comments BEGIN_CUSTOM_EF677073_10AC_44FE_AF1F_2AED27E06048 and
END_CUSTOM_EF677073_10AC_44FE_AF1F_2AED27E06048, placed directly under
the root element, survives; it is added back at the end of the root element
of the new file. The file backup on the package's Files Backup page is
the only other copy. See
Upgrade a Production Installation.
Result
The IIS site that hosts the Web App, the Self Service Portal, and the API carries the security headers in its configuration, and after the restart it sends them with the responses of the web applications.