Skip to content

Commit ea34498

Browse files
committed
Cloud: custom headers in rewrite rules
1 parent cce728e commit ea34498

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/cloud/redirects.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,18 @@ rewrites:
127127
pathname: '/(favicon.ico|.well-known|dist)/*?'
128128
destination: '{artifactBaseUrl}/{request.uri}'
129129
```
130+
131+
### Custom Headers <Since ver="2.16.0" repo="craftcms/cloud-extension-yii2" product="Cloud extension" description="The ability to set custom headers in rewrite rules was added in {product} {ver}." :use-changelog="false" />
132+
133+
You can set arbitrary HTTP headers on any rewritten response by including a key-value map under a `headers` key:
134+
135+
```yml
136+
rewrites:
137+
- pattern:
138+
pathname: '/dist/js/*'
139+
destination: '{artifactBaseUrl}/{request.uri}'
140+
headers:
141+
Access-Control-Allow-Origin: 'https://mydomain.com'
142+
```
143+
144+
Headers are combined with those from the `destination`, overwriting any shared names.

0 commit comments

Comments
 (0)