Skip to main content
Gcore CDN provides two options for controlling response headers: Response headers (add) adds custom HTTP headers to CDN server responses, and Response headers (hide) removes specific origin headers before delivery.

Add response headers

The Response headers (add) option sets custom HTTP headers that CDN servers include in responses to end users. If the same header is already configured on the origin server, the CDN server overrides its value. To configure the option:
  1. In the Gcore Customer Portal, navigate to CDNCDN resources.
  2. Click the resource to open its settings.
  3. In the left panel, click HTTP headers to expand the section, then click Response headers (add) to jump to the option.
  4. Enable the Add response headers toggle.
Up to 50 response headers can be added per resource.
CDN resource settings with the Response headers add option expanded, showing Header name and Value fields
  1. In the Header name field, enter a header name.
  2. In the Value field, enter the header value.
  3. The Always add the header to response from CDN regardless of response code checkbox is enabled by default, which adds the header to all responses. To add the header only to responses with codes 200, 201, 204, 206, 301, 302, 303, 304, 307, and 308, uncheck the box.
  4. Click Add header to add more headers. Fill in the fields for each additional header.
  5. Click Save changes.
In the CDN API, this option is the static_response_headers field in the resource options object. Gcore deprecated staticHeaders in favor of static_response_headers — use the latter for all new configurations. The always field on each header object controls status code filtering: false limits the header to responses with codes 200, 201, 204, 206, 301, 302, 303, 304, 307, and 308; true adds it to all responses regardless of status code.
To set custom response headers via the API, include static_response_headers in the resource options:

Add multiple header values

To add more than one value to the same header, enter them in the Value field in one of two ways:
  • Separate strings: enter the first value and press Enter, then enter the second value and press Enter. Repeat for each additional value.
Response headers add form with multiple values entered on separate lines in the Value field
The response header appears as:
  • Single string: enter all values in the Value field separated by commas.
Response headers add form with comma-separated values in the Value field
The response header appears as: Example: one, two, three Both methods can be combined: enter values separated by commas and press Enter to start a new string.
Response headers add form with combined comma-separated and multi-line values in the Value field
The response header appears as:
Valid characters for fields:
  • Header name: Latin letters (A–Z, a–z), numbers (0–9), underscore (_) and hyphen (-)
  • Value: Latin letters (A–Z, a–z), numbers (0–9), a space and the following special characters: ~!@#%^&*()-_=+ /|";:?.><{}[]
Value field restrictions:
  • Invalid characters: $'
  • Cannot start with a special character
  • Cannot contain only special characters

Check headers

After saving the configuration, verify the header appears in CDN responses.
  1. Clear the cache of the CDN resource or files for which the header was added.
  2. Run the following cURL command, substituting the file URL:
  1. If the response contains the configured header, the setup is complete.

Hide response headers

By default, a CDN server passes all HTTP headers it receives from the origin server to end users. To control which headers are included in responses:
  1. In the Customer Portal, navigate to CDNCDN resources.
  2. Click the resource to open its settings.
  3. In the left panel, click HTTP headers to expand the section, then click Response headers (hide) to jump to the option.
  4. Enable the Hide response headers toggle.
CDN resource settings with the Response headers hide option enabled, showing Hide all except and Hide only radio buttons
  1. Select a mode:
  • Hide all except — set the headers to keep in the response; all other headers are hidden. After enabling, the most common headers appear pre-filled. Remove headers by clicking the × icon, or add headers by clicking the HTTP headers row and selecting from the list or entering a name. Header names accept letters (a–z), numbers (0–9), dashes (-), and underscores (_).
Hide all except mode with pre-populated common response headers shown as removable tags
  • Hide only — set the headers to hide from the response; all other headers are kept. Click the HTTP headers row and select from the list or enter custom header names.
Hide only mode with an empty field for entering headers to hide from responses
Headers available in the portal: accept, accept-charset, accept-encoding, accept-language, accept-ranges, age, allow, alternates, authorization, cache-control, content-disposition, content-encoding, content-language, content-location, content-md5, content-range, content-version, derived-from, etag, expect, expires, from, host, if-match, if-modified-since, if-none-match, if-range, if-unmodified-since, last-modified, link, location, max-forwards, mime-version, pragma, proxy-authenticate, proxy-authorization, public, range, referer, retry-after, title, te, trailer, transfer-encoding, upgrade, user-agent, vary, via, warning, www-authenticate, keep-alive.
The following headers are mandatory and cannot be hidden: connection, content-length, content-type, server, and date.
  1. Click Save changes.