You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/ISSUE_TEMPLATE/feature-request.yml
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
name: 🚀 Feature request
2
-
description: Suggest a feature that will improve Nuxt KQL
2
+
description: Suggest a feature that will improve Nuxt Kirby
3
3
labels: [pending triage]
4
4
body:
5
5
- type: markdown
@@ -12,7 +12,7 @@ body:
12
12
id: feature-description
13
13
attributes:
14
14
label: Describe the feature
15
-
description: A clear and concise description of what you think would be a helpful addition to Nuxt KQL, including the possible use cases and alternatives you have considered.
15
+
description: A clear and concise description of what you think would be a helpful addition to Nuxt Kirby, including the possible use cases and alternatives you have considered.
16
16
placeholder: Feature description
17
17
validations:
18
18
required: true
@@ -30,5 +30,5 @@ body:
30
30
label: Final checks
31
31
description: 'Before submitting, please make sure you do the following:'
Solutions to frequently encountered problems when using Nuxt Kirby.
4
+
5
+
## CORS Issues
6
+
7
+
### Can I Encounter CORS Issues?
8
+
9
+
**tl;dr**: No, since Nuxt will proxy requests to Kirby through its own server.
10
+
11
+
With the default module configuration, you will not have to deal with CORS issues. [`useKql`](/api/use-kql), [`useKirbyData`](/api/use-kirby-data), [`$kql`](/api/kql), and [`$kirby`](/api/kirby) pass a given request to the internal Nuxt server route `/api/__kirby__` set up by the module.
12
+
13
+
On the server, the request is forwarded to the Kirby instance, and the response is sent back to the client. Since the request is made server-side, CORS is not an issue.
14
+
15
+
### What if I Enable Client-Side Requests?
16
+
17
+
If you enable `client: true` in your configuration, requests go directly from the browser to Kirby, which may encounter CORS issues depending on your Kirby setup.
18
+
19
+
**Solution**: Configure CORS headers in your Kirby installation:
20
+
21
+
```php
22
+
// site/config/config.php
23
+
return [
24
+
'api' => [
25
+
'basicAuth' => true,
26
+
'allowInsecure' => true // for development only
27
+
],
28
+
'hooks' => [
29
+
'route:before' => function ($route, $path, $method) {
30
+
if ($method === 'OPTIONS') {
31
+
header('Access-Control-Allow-Origin: *');
32
+
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
No, since Nuxt will proxy requests to Kirby through its own server.
5
+
:::
6
+
7
+
With the default module configuration, you will not have to deal with CORS issues. [`useKql`](/api/use-kql), [`useKirbyData`](/api/use-kirby-data), [`$kql`](/api/kql), and [`$kirby`](/api/kirby) pass a given request to the internal Nuxt server route `/api/__kirby__` set up by the module.
8
+
9
+
On the server, the request is forwarded to the Kirby instance, and the response is sent back to the client. Since the request is made server-side, CORS is not an issue.
10
+
11
+
### What if I Enable Client-Side Requests?
12
+
13
+
When enabling `client: true` in your Nuxt Kirby configuration, requests are sent directly from the browser to Kirby, which may encounter CORS issues depending on your Kirby setup.
14
+
15
+
If you have followed the [Getting Started guide](essentials/getting-started.html#step-3-set-up-your-kirby-backend), your Kirby instance should already be configured with the [Kirby Headless plugin](https://kirby.tools/docs/headless/getting-started/). It includes default CORS settings that allow requests from any origin.
0 commit comments