自訂 HTTP 回應標題

In some cases, it is useful to apply custom HTTP response headers to resources, for example to allow CORS. If you want to specify headers, create either an Excel Workbook or a Google Sheets Workbook in the /.helix folder of your website in Sharepoint or Google Drive called headers.xlsx in SharePoint or headers in Google Drive.

The workbook should have only one sheet and can define response headers using the url/key/value format as shown below.

The URL column is a glob pattern matching the pages that should have the header should be applied to. A wildcard * can be used as a prefix or suffix, allowing for flexible matches on the URL pathname. Typical examples include /docs/** or **/docs/**.

After you update the sheet, you need to preview it. Note that the headers are applied to the preview and live versions of the page. You might need to purge the live or production cache for the change to take effect. See the Admin API documentation for more information.

If the headers apply to resources in codebus (coming from a sync GitHub repository, as opposed to content) then the changes won’t take effect until the codebus is synced again, either by updating the targeted code in GitHub or by manually updating via the Admin API.

recommendation-more-help
fbcff2a9-b6fe-4574-b04a-21e75df764ab