<h2>HTTP Response Headers</h2><br/><div style="overflow-x:auto"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta content="text/html; charset=UTF-8" /><meta name="copyright" content="(C) Copyright 2024" /><meta name="DC.rights.owner" content="(C) Copyright 2024" /><meta name="generator" content="DITA-OT" /><meta name="DC.type" content="concept" /><meta name="DC.title" content="HTTP Response Headers" /><meta name="abstract" content="A response header is a simple name-value pair used in an HTTP response to provide additional information about page content or how the client should process it." /><meta name="description" content="A response header is a simple name-value pair used in an HTTP response to provide additional information about page content or how the client should process it." /><meta name="DC.relation" scheme="URI" content="../../../integrate/web-services/reference/r_AvailableWebServices.html" /><meta name="DC.relation" scheme="URI" content="../../../build/applications/concept/api-implementation-reference.html" /><meta name="DC.relation" scheme="URI" content="../../../build/applications/concept/api-implementation.html" /><meta name="DC.relation" scheme="URI" content="../../../administer/http-response-headers/concept/configure-http-response-header.html" /><meta name="DC.relation" scheme="URI" content="../../../integrate/custom-web-services/concept/c_SpecifyContentType.html" /><meta name="DC.relation" scheme="URI" content="../administer/security/reference/cache-control-http-header-value.dita/cache-control-http-header-value.html" /><meta name="DC.relation" scheme="URI" content="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors" /><meta name="DC.relation" scheme="URI" content="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors" /><meta name="DC.relation" scheme="URI" content="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options" /><meta name="DC.relation" scheme="URI" content="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options" /><meta name="DC.creator" content="David Miller" /><meta name="DC.creator" content="Mark Moulder" /><meta name="DC.creator" content="ServiceNow" /><meta name="DC.date.created" content="2023-08-03" /><meta name="DC.date.modified" content="2023-08-03" /><meta name="DC.format" content="XHTML" /><meta name="DC.identifier" content="http-response-header" /><link rel="stylesheet" type="text/css" href="../../../CSS/commonltr.css" /><title>HTTP Response Headers</title></head><body id="http-response-header"> <div class="breadcrumb"><a class="link" href="../../../build/applications/concept/api-implementation-reference.html" title="Get started using ServiceNow APIs with guides, resources, and reference documentation.">API implementation and reference</a> > <a class="link" href="../../../build/applications/concept/api-implementation.html" title="You can use JavaScript APIs to extend application server and client functionality. Use web services to connect ServiceNow applications to other software applications.">API implementation</a> > </div> <h1 class="title topictitle1" id="ariaid-title1">HTTP Response Headers</h1> <div class="body conbody"><p class="shortdesc">A response header is a simple name-value pair used in an HTTP response to provide additional information about page content or how the client should process it.</p> <p class="p">You can configure HTTP response headers for all, or specific types of pages, which include <span class="ph">Service Portal</span>, UI Page, or UX applications. The ability to configure and pass response headers enables special handling of the page content by a client, most typically a browser.</p> <p class="p">To learn more about what an HTTP header is, and about configuring the name-value pair for specific HTTP response headers, see:<a class="xref" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers" target="_blank" rel="noopener noreferrer">https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers</a></p> <div class="p">When configuring response headers, you must look at the definition for the HTTP header to determine how the client would handle the page content. <ul class="ul" id="http-response-header__ul_pfr_cn2_14b"><li class="li">For example, you configure an HTTP header for a specific page or all the pages with a Content-Security-Policy: frame-ancestors 'self' https://www.servicenow.com.</li><li class="li">When you invoke the page in a browser such as Chrome, you can review it in the Response Headers section of Chrome Developer Tools.<p class="p"><img class="image" id="http-response-header__image_itf_shg_wnb" src="../image/CSP-frame-ancestors-Response-Header.png" alt="HTTP header with Content-Security-Policy: frame-ancestors 'self'" /></p> </li></ul> </div> <p class="p">To learn more about how browsers handle a page with frame-ancestors, see <a class="xref" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors" target="_blank" rel="noopener noreferrer">https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors</a>.</p> <div class="note warning"><span class="warningtitle">Warning:</span> When using URLs with custom name-value pairs, proceed with caution because there is a potential security risk when doing so. The signed security amendment to the <span class="ph">Now Platform</span> contract has implied security. You may potentially or accidentally override it when you use custom name-value pairs in the resulting URLs. <ul class="ul" id="http-response-header__ul_njb_pbm_14b"><li class="li">If you want to entirely disable HTTP response header configuration functions, set the <span class="keyword parmname">glide.http.headers_config.enabled</span> property to <span class="ph uicontrol">false</span>.</li><li class="li">Once you set it to false, <span class="ph">Now Platform</span> does not use any of the header configurations you defined in the sys_response_header table.</li></ul> </div> <div class="section" id="http-response-header__section_my5_351_14b"><h2 class="title sectiontitle">Special handling of the Content-Security-Policy: frame-ancestor header</h2> <div class="p">Normally, the <span class="ph">Now Platform</span> automatically includes the X-Frame-Options: SAMEORIGIN header. <ul class="ul" id="http-response-header__ul_e1f_lbm_14b"><li class="li">It supports use of this header in all types of browsers, based on the setting of the <span class="keyword parmname">glide.set_x_frame_options</span> global property, which is enabled by default.</li><li class="li">When you configure a page with a Content-Security-Policy: frame-ancestor 'self' URL1 URL2 header, the <span class="ph">Now Platform</span> does not automatically include the X-Frame-Options: SAMEORIGIN header. Excluding it prevents the browser from being confused, because Content-Security-Policy: frame-ancestor 'self' already has a similar effect.</li></ul> </div> </div> <div class="section" id="http-response-header__section_ny5_351_14b"><h2 class="title sectiontitle">Special handling of Content-Security-Policy: frame-ancestor header for Internet Explorer</h2> <div class="p">Using the Content-Security-Policy: frame-ancestor 'self' URL1 URL2 header enables you to configure multiple URL sources to include the page from within an iFrame rendered from a third-party site. However, Internet Explorer does not support this type of header. <ul class="ul" id="http-response-header__ul_ykg_xk2_14b"><li class="li">Instead, the Internet Explorer only supports the X-Frame-Options: ALLOW-FROM URL (ALLOW-FROM) directive in this header, although the restriction is for a single host URL.</li><li class="li">If you configure the frame-ancestor 'self' URL1 URL2 header, and Internet Explorer is in use, the <span class="ph">Now Platform</span> automatically uses the X-Frame-Options: ALLOW-FROM URL (ALLOW-FROM) header instead.</li></ul> </div> <div class="p">If the Internet Explorer request includes the referrer URL header: <ul class="ul" id="http-response-header__ul_qf5_2l2_14b"><li class="li">It attempts to match it with the host URLs (full or wildcard http://*.example.com type URL format only) configured in the Content-Security-Policy: frame-ancestor 'self' URL1 URL2 header.</li><li class="li">If there is a match, include the matched URL as X-Frame-Options: ALLOW-FROM URL1.</li><li class="li">If there is no referrer header, it uses the first non-wildcard based host URLs configured in the Content-Security-Policy: frame-ancestor 'self' URL1 URL2 header.</li></ul> <div class="note"><span class="notetitle">Note:</span> When configuring URLs, do not include a forward slash at the end of the URL. <ul class="ul" id="http-response-header__ul_wdh_ntg_14b"><li class="li">This example of an incorrect configuration that may not work properly with this special handling:<ul class="ul" id="http-response-header__ul_bgt_53r_nsb"><li class="li">Name: Content-Security-Policy</li><li class="li">Value: frame-ancestors 'self' https://microsoft.com/</li></ul> </li><li class="li">Use this correct syntax instead:<ul class="ul" id="http-response-header__ul_s32_x3r_nsb"><li class="li">Name: Content-Security-Policy</li><li class="li">Value: frame-ancestors 'self' https://microsoft.com</li></ul> </li></ul> </div> </div> </div> </div> <div class="related-links"> <ul class="ullinks"><li class="link ulchildlink"><strong><a href="../../../administer/http-response-headers/concept/configure-http-response-header.html">Configure HTTP response headers</a></strong><br /> Configure standard name-value pairs for HTTP response headers. You designate if the configuration applies to all pages, or to specific types (<span class="ph">Service Portal</span>, UI Page, or UX application record).</li></ul> <div class="familylinks"> <div class="parentlink"><strong>Parent Topic:</strong> <a class="link" href="../../../integrate/web-services/reference/r_AvailableWebServices.html" title="HTTP-based web services allow diverse applications to talk to each other. ServiceNow supports both inbound (provider) and outbound (consumer) web services.">Web services</a></div> </div> <div class="linklist relinfo relconcepts"><strong>Related concepts</strong><br /> <ul class="linklist"><li class="linklist"><a class="link" href="../../../integrate/custom-web-services/concept/c_SpecifyContentType.html" title="Controls which content types are allowed in scripted REST API requests and responses.">Control request and response content type</a></li></ul></div> <div class="linklist relinfo"><strong>Related topics</strong><br /> <ul class="linklist"><li class="linklist"><a class="link" href="../administer/security/reference/cache-control-http-header-value.dita/cache-control-http-header-value.html" target="_blank" rel="noopener noreferrer">Cache-Control HTTP header value</a></li><li class="linklist"><a class="link" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors" target="_blank" rel="noopener noreferrer">Content-Security-Policy: frame-ancestor 'self' URL1 URL2</a></li><li class="linklist"><a class="link" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options" target="_blank" rel="noopener noreferrer">X-Frame-Options: SAMEORIGIN</a></li><li class="linklist"><a class="link" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options" target="_blank" rel="noopener noreferrer">X-Frame-Options: ALLOW-FROM URL</a></li></ul></div> </div> </body></html></div>