Skip to content

Commit 7f8463a

Browse files
committed
Portal B20: prefer env + config file tabs, add config key links
- Replace Kubernetes (Helm) tabs with Config file (JSON) tabs on all three Portal CORS steps - Link PORTAL_CORS_ENABLE and PORTAL_CORS_ALLOWED_ORIGINS to their exact anchors in the configuration reference wherever they appear in prose and warning callouts - Remove Type column from optional settings table
1 parent 08df9a5 commit 7f8463a

1 file changed

Lines changed: 33 additions & 25 deletions

File tree

portal/how-to-guides/configure-cors.mdx

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,33 @@ Cross-origin request configuration in the Developer Portal involves two independ
2020
Portal application CORS controls which external origins may call the Portal's own Admin API and Live Portal routes. It is configured via environment variables on the Portal process.
2121

2222
<Warning>
23-
`PORTAL_CORS_ENABLE` defaults to `false`. All cross-origin requests to the Portal are rejected until you set this to `true`.
23+
[`PORTAL_CORS_ENABLE`](/product-stack/tyk-enterprise-developer-portal/deploy/configuration#portal-cors-enable) defaults to `false`. All cross-origin requests to the Portal are rejected until you set this to `true`.
2424
</Warning>
2525

2626
1. **Enable CORS**
2727

28-
Set `PORTAL_CORS_ENABLE=true` on the Portal process.
28+
Set [`PORTAL_CORS_ENABLE`](/product-stack/tyk-enterprise-developer-portal/deploy/configuration#portal-cors-enable) to `true` on the Portal process.
2929

3030
<Tabs>
3131
<Tab title="Environment variable">
3232
```ini
3333
PORTAL_CORS_ENABLE=true
3434
```
3535
</Tab>
36-
<Tab title="Kubernetes (Helm)">
37-
```yaml
38-
extraEnvs:
39-
- name: PORTAL_CORS_ENABLE
40-
value: "true"
36+
<Tab title="Config file">
37+
```json
38+
{
39+
"CORS": {
40+
"Enable": true
41+
}
42+
}
4143
```
4244
</Tab>
4345
</Tabs>
4446

4547
2. **Set allowed origins**
4648

47-
Set `PORTAL_CORS_ALLOWED_ORIGINS` to the origins permitted to make cross-origin requests to the Portal. Use the exact scheme and host of each origin, separated by commas. Wildcards are supported.
49+
Set [`PORTAL_CORS_ALLOWED_ORIGINS`](/product-stack/tyk-enterprise-developer-portal/deploy/configuration#portal-cors-allowed-origins) to the origins permitted to make cross-origin requests to the Portal. Use the exact scheme and host of each origin, separated by commas. Wildcards are supported.
4850

4951
{/* TODO: Verify the default behavior when PORTAL_CORS_ALLOWED_ORIGINS is unset. Code analysis (rs/cors library) indicates an empty slice allows all origins. The configuration reference states no origins are allowed by default. Confirm with the Portal team before documenting a specific default. */}
5052

@@ -54,17 +56,22 @@ Portal application CORS controls which external origins may call the Portal's ow
5456
PORTAL_CORS_ALLOWED_ORIGINS=https://admin.example.com,https://developer.example.com
5557
```
5658
</Tab>
57-
<Tab title="Kubernetes (Helm)">
58-
```yaml
59-
extraEnvs:
60-
- name: PORTAL_CORS_ALLOWED_ORIGINS
61-
value: "https://admin.example.com,https://developer.example.com"
59+
<Tab title="Config file">
60+
```json
61+
{
62+
"CORS": {
63+
"AllowedOrigins": [
64+
"https://admin.example.com",
65+
"https://developer.example.com"
66+
]
67+
}
68+
}
6269
```
6370
</Tab>
6471
</Tabs>
6572

6673
<Warning>
67-
Do not set `PORTAL_CORS_ALLOWED_ORIGINS` to `*` when `PORTAL_CORS_ALLOW_CREDENTIALS=true`. The CORS specification does not allow credentialed requests from wildcard origins. Specify each origin explicitly instead.
74+
Do not set [`PORTAL_CORS_ALLOWED_ORIGINS`](/product-stack/tyk-enterprise-developer-portal/deploy/configuration#portal-cors-allowed-origins) to `*` when `PORTAL_CORS_ALLOW_CREDENTIALS=true`. The CORS specification does not allow credentialed requests from wildcard origins. Specify each origin explicitly instead.
6875
</Warning>
6976

7077
3. **Set allowed headers and methods**
@@ -78,23 +85,24 @@ Portal application CORS controls which external origins may call the Portal's ow
7885
PORTAL_CORS_ALLOWED_METHODS=GET,POST,PUT,DELETE,OPTIONS
7986
```
8087
</Tab>
81-
<Tab title="Kubernetes (Helm)">
82-
```yaml
83-
extraEnvs:
84-
- name: PORTAL_CORS_ALLOWED_HEADERS
85-
value: "Authorization,Content-Type,X-Requested-With"
86-
- name: PORTAL_CORS_ALLOWED_METHODS
87-
value: "GET,POST,PUT,DELETE,OPTIONS"
88+
<Tab title="Config file">
89+
```json
90+
{
91+
"CORS": {
92+
"AllowedHeaders": ["Authorization", "Content-Type", "X-Requested-With"],
93+
"AllowedMethods": ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
94+
}
95+
}
8896
```
8997
</Tab>
9098
</Tabs>
9199

92100
4. **(Optional) Configure additional CORS settings**
93101

94-
| Config key | Type | Default | Description |
95-
|---|---|---|---|
96-
| [`CORS.MaxAge`](/product-stack/tyk-enterprise-developer-portal/deploy/configuration#portal-cors-max-age) | `int` | `0` | How long, in seconds, browsers may cache the preflight response. A positive value reduces preflight round trips. |
97-
| [`CORS.AllowCredentials`](/product-stack/tyk-enterprise-developer-portal/deploy/configuration#portal-cors-allow-credentials) | `bool` | `false` | Whether the Portal includes credentials (cookies, HTTP authentication) in CORS responses. |
102+
| Config key | Default | Description |
103+
|---|---|---|
104+
| [`CORS.MaxAge`](/product-stack/tyk-enterprise-developer-portal/deploy/configuration#portal-cors-max-age) | `0` | How long, in seconds, browsers may cache the preflight response. A positive value reduces preflight round trips. |
105+
| [`CORS.AllowCredentials`](/product-stack/tyk-enterprise-developer-portal/deploy/configuration#portal-cors-allow-credentials) | `false` | Whether the Portal includes credentials (cookies, HTTP authentication) in CORS responses. |
98106

99107
5. **Restart the Portal**
100108

0 commit comments

Comments
 (0)