Skip to content

Commit

Permalink
Add docs on cors runtime setting (#644)
Browse files Browse the repository at this point in the history
* Add docs on cors runtime setting

* Update docs

* Apply suggestions from code review

Co-authored-by: peasee <[email protected]>

---------

Co-authored-by: peasee <[email protected]>
  • Loading branch information
phillipleblanc and peasee authored Nov 20, 2024
1 parent 5fe59a8 commit e5293a5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spiceaidocs/docs/api/http/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,15 @@ import DocCardList from '@theme/DocCardList';
## Authentication

API Key authentication is supported for all HTTP routes. See [API Key Authentication](../../api/auth/index.md) for more details.

## Cross-Origin Resource Sharing (CORS)

CORS is disabled by default. Enable for all origins with:

```yaml
runtime:
cors:
enabled: true
```
See [CORS](/reference/spicepod/index.md#runtimecors) for more details.
31 changes: 31 additions & 0 deletions spiceaidocs/docs/reference/spicepod/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,37 @@ runtime:
- `retention_period` - optional, how long records in the task history table should be retained. Default is `8h`, or 8 hours.
- `retention_check_interval` - optional, how often should old records be checked for removal. Default is `15m`, or 15 minutes.

### `runtime.cors`

The CORS section specifies the configuration for enabling Cross-Origin Resource Sharing (CORS) for the HTTP endpoint. By default, CORS is disabled.

Default configuration:

```yaml
runtime:
cors:
enabled: false
```

### `runtime.cors.enabled`

Enables or disables CORS for the HTTP endpoint. `false` by default.

### `runtime.cors.allowed_origins`

A list of allowed origins for CORS requests. `["*"]` by default, which allows all origins.

Example:

```yaml
runtime:
cors:
enabled: true
allowed_origins: ["https://example.com"]
```

This configuration allows requests from the `https://example.com` origin only.

## `metadata`

An optional `map` of metadata.
Expand Down

0 comments on commit e5293a5

Please sign in to comment.