---
schema_version: "1"
id: 62816a78d002069b8277a9c6078154d6ceaa9db8bcad2ac490eadc4c94e38c85
title: HTTP 响应标头
collection: tableau
version: current
locale: zh-cn
portal_url: https://docs.salesforce.com/tableau/current/zh-cn/server/security_http_headers.md
canonical_url: https://help.tableau.com/current/server/zh-cn/security_http_headers.htm
source_site: help.tableau.com
content_type: documentation
content_hash: 2f7c3084768415f886ee593f2df1ab858ff5df631fadab7a413dcb55c9c1a0ad
description: Configure HTTP response headers such as HSTS and Referrer-Policy on Tableau Server.
---
[跳转到主要内容](#main-content)

# HTTP 响应标头

Tableau Server 支持 [OWASP Secure Headers Project](https://owasp.org/www-project-secure-headers/#div-headers) 中指定的某些响应标头。

本主题介绍如何为 Tableau Server 配置以下响应标头：

- HTTP 严格传输安全性 (HSTS)
- Referrer-Policy
- X-Content-Type-Options
- X-XSS-Protection

Tableau Server 还支持内容安全策略 (CSP) 标准。本主题未讨论 CSP 配置。请参见[内容安全策略](https://help.tableau.com/current/server/zh-cn/security_csp.htm)。

## 配置响应标头

所有响应标头都是使用 [tsm configuration set](https://help.tableau.com/current/server/zh-cn/cli_configuration_tsm.htm#TSMSet) 命令配置的。

配置完响应标头后，运行 [tsm pending-changes apply](https://help.tableau.com/current/server/zh-cn/cli_pending-changes.htm#pending-changes-apply)。

如果待定更改需要重新启动服务器，`pending-changes apply` 命令将显示一个提示，告知您将进行重新启动。即使服务器已停止，此提示也会显示，但在这种情况下不会重新启动。您可以使用 `--ignore-prompt` 选项隐藏提示，但这样做不会改变重新启动行为。如果更改不需要重新启动，则会在不提示的情况下应用更改。有关详细信息，请参见[tsm pending-changes apply](https://help.tableau.com/current/server/zh-cn/cli_pending-changes.htm#pending-changes-apply)。

## HTTP 严格传输安全性 (HSTS)

HSTS 强制连接到 Tableau Server 的客户端使用 HTTPS 进行连接。有关详细信息，请参见 OWASP 条目 [HTTP 严格传输安全性 (HSTS)](https://owasp.org/www-project-secure-headers/#div-headers)。

### 选项

gateway.http.hsts

默认值：`false`

HTTP 严格传输安全性 (HSTS) 头强制浏览器在启用它的域上使用 HTTPS。

gateway.http.hsts\_options

默认值：`"max-age=31536000"`

默认情况下，会为一年（31536000 秒）期间设置 HSTS 策略。此时间段指定浏览器将通过 HTTPS 访问服务器的时间量。

## Referrer-Policy

从 2019.2 开始，Tableau Server 包括配置 Referrer-Policy HTTP 标头行为的功能。此策略启用时的默认行为是将包括所有“secure as”连接的来源 URL（策略 `no-referrer-when-downgrade`）。在以前的版本中，Tableau Server 发送的响应中未包括 Referrer-Policy 标头。有关 Referrer-Policy 支持的各种策略选项的详细信息，请参见 OWASP 条目 [Referrer-Policy](https://owasp.org/www-project-secure-headers/#div-headers)。

### 选项

gateway.http.referrer\_policy\_enabled

默认值：`true`

若要从 Tableau Server 发送的响应中排除 Referrer-Policy 标头，请将此值设置为 `false`。

gateway.http.referrer\_policy

默认值：`no-referrer-when-downgrade`

此选项定义 Tableau Server 的引用页策略。您可以指定 OWASP 网页上的 [Referrer-Policy](https://owasp.org/www-project-secure-headers/#div-headers) 表中列出的任何策略值字符串。

## X-Content-Type-Options

X-Content-Type-Options 响应 HTTP 头指定 Content-Type 头中的 MIME 类型不应由浏览器更改。在某些情况下，如果未指定 MIME 类型，则浏览器可能会通过评估有效负载的特征来尝试确定 MIME 类型。然后浏览器将相应地显示内容。这个过程被称为“嗅探”。误解 MIME 类型可能会导致安全漏洞。

有关详细信息，请参见 OWASP 条目 [X-Content-Type-Options](https://owasp.org/www-project-secure-headers/#div-headers)。

### 选项

gateway.http.x\_content\_type\_nosniff

默认值：`true`

默认情况下，系统使用此选项将 X-Content-Type-Options HTTP 头设置为“nosniff”。

## X-XSS-Protection

HTTP X-XSS-Protection 响应头会发送到浏览器以启用跨站点脚本 (XSS) 保护。在用户在浏览器中禁用 XSS 保护的情况下，X-XSS-Protection 响应头会覆盖配置。

有关详细信息，请参见 OWASP 条目 [X-XSS-Protection](https://owasp.org/www-project-secure-headers/#div-headers)。

### 选项

gateway.http.x\_xss\_protection

默认值：`true`

默认情况下，系统使用此选项启用了 X-XSS-Protection 响应头。

## 此部分中的其他文章