Skip to content

Commit 9ce883d

Browse files
docs: Move CORS configuration to the REST API page (#6431)
* Move * Lint * Update docs/content/REST-API/REST-API.mdx Co-authored-by: Hassan Khan <[email protected]> --------- Co-authored-by: Hassan Khan <[email protected]>
1 parent 133c9e0 commit 9ce883d

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

docs/content/Configuration/Overview.mdx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,6 @@ mode does the following:
4747
- Logs incorrect/invalid configuration for `externalRefresh` /`waitForRenew`
4848
instead of throwing errors
4949

50-
## Configuring CORS
51-
52-
The Cube REST API supports Cross-Origin Resource Sharing (CORS) for all API
53-
requests. By default, the middleware allows requests from any origin (`*`). To
54-
change the allowed domain, you can do the following:
55-
56-
```javascript
57-
module.exports = {
58-
http: {
59-
cors: {
60-
origin: 'https://myapp.com',
61-
},
62-
},
63-
};
64-
```
65-
66-
Please consult the Configuration Reference [for more
67-
options][link-config-cors-opts].
68-
6950
## Concurrency and pooling
7051

7152
<InfoBox>
@@ -85,7 +66,6 @@ default, you must ensure that the new value is greater than the number of
8566
concurrent connections used by Cube's query queues and refresh scheduler.
8667

8768
[link-config]: /config
88-
[link-config-cors-opts]: /config#http
8969
[link-dev-playground]: /dev-tools/dev-playground
9070
[link-env-vars]: /reference/environment-variables
9171
[link-scheduled-refresh]: /schema/reference/pre-aggregations#scheduled-refresh

docs/content/REST-API/REST-API.mdx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,28 @@ you can still use it to pass a security context.
3838
curl -H "Authorization: EXAMPLE-API-TOKEN" https://example.com/cubejs-api/v1/sql
3939
```
4040

41+
### <--{"id" : "Prerequisites"}--> Configuring CORS
42+
43+
REST API supports [Cross-Origin Resource Sharing (CORS)][cors].
44+
45+
By default, requests from any origin (`*`) are allowed. To allow requests from a
46+
specific domain only, use the following configuration in the `cube.js` file:
47+
48+
```javascript
49+
module.exports = {
50+
http: {
51+
cors: {
52+
origin: 'https://example.com',
53+
},
54+
},
55+
};
56+
```
57+
58+
Please see [configuration options][ref-config-cors] for details.
59+
60+
[cors]: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
61+
[ref-config-cors]: /config#http
62+
4163
### <--{"id" : "Prerequisites"}--> Continue wait
4264

4365
If the request takes too long to be processed, Cube Backend responds with

0 commit comments

Comments
 (0)