chore(docs): Generated References (#6904)
Generated the following references: - `inventory` - `js_client` - `medusa` - `medusa_config` - `medusa_react` - `modules` - `payment` - `pricing` - `product` - `services` - `stock_location` - `tax_calculation` - `types` - `workflows` Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
This commit is contained in:
co-authored by
Shahed Nasser
parent
85e5478873
commit
7fe164bc1d
+48
@@ -152,6 +152,54 @@ module.exports = {
|
||||
|
||||
### auth\_cors
|
||||
|
||||
The Medusa backend’s API Routes are protected by Cross-Origin Resource Sharing (CORS). So, only allowed URLs or URLs matching a specified pattern can send requests to the backend’s API Routes.
|
||||
|
||||
`auth_cors` is a string used to specify the accepted URLs or patterns for API Routes starting with `/auth`. It can either be one accepted origin, or a comma-separated list of accepted origins.
|
||||
|
||||
Every origin in that list must either be:
|
||||
|
||||
1. A URL. For example, `http://localhost:7001`. The URL must not end with a backslash;
|
||||
2. Or a regular expression pattern that can match more than one origin. For example, `.example.com`. The regex pattern that the backend tests for is `^([/~@;%#'])(.*?)\1([gimsuy]*)$`.
|
||||
|
||||
#### Example
|
||||
|
||||
Some example values of common use cases:
|
||||
|
||||
```bash
|
||||
# Allow different ports locally starting with 700
|
||||
AUTH_CORS=/http://localhost:700\d+$/
|
||||
|
||||
# Allow any origin ending with vercel.app. For example, admin.vercel.app
|
||||
AUTH_CORS=/vercel\.app$/
|
||||
|
||||
# Allow all HTTP requests
|
||||
AUTH_CORS=/http://.+/
|
||||
```
|
||||
|
||||
Then, set the configuration in `medusa-config.js`:
|
||||
|
||||
```js title="medusa-config.js"
|
||||
module.exports = {
|
||||
projectConfig: {
|
||||
auth_cors: process.env.AUTH_CORS,
|
||||
// ...
|
||||
},
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
If you’re adding the value directly within `medusa-config.js`, make sure to add an extra escaping `/` for every backslash in the pattern. For example:
|
||||
|
||||
```js title="medusa-config.js"
|
||||
module.exports = {
|
||||
projectConfig: {
|
||||
auth_cors: "/http:\\/\\/localhost:700\\d+$/",
|
||||
// ...
|
||||
},
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
### cookie\_secret
|
||||
|
||||
A random string used to create cookie tokens. Although this configuration option is not required, it’s highly recommended to set it for better security.
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user