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
When trying to use the Kanboard API with Axios from a different origin (e.g., http://localhost:8081), I encounter a CORS policy issue. The browser blocks the request due to the absence of the Access-Control-Allow-Origin header in the response from jsonrpc.php.
Error Message:
Access to XMLHttpRequest at 'http://kanboard.local/jsonrpc.php' from origin 'http://localhost:8081' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Proposed Solution:
To solve this issue, I suggest adding the following headers to jsonrpc.php:
Before adding these headers, I'd like to discuss potential security implications. Are there any concerns with allowing cross-origin requests from any domain (*)? Should we restrict the allowed origins to specific domains or implement additional security measures?
Please let me know if this draft issue meets your requirements or if you'd like me to make any changes!
The text was updated successfully, but these errors were encountered:
Ideally, this feature should be configurable with at least 2 options:
One option to enable the CORS headers (disabled by default)
Another option to change the value of Access-Control-Allow-Origin (the default value can be *)
Regarding the HTTP headers, Access-Control-Max-Age could be added as well. For example, setting Access-Control-Max-Age: 3600 can reduce the number of preflight requests.
This logic could be implemented in a middleware instead of changing jsonrpc.php. There is an existing class Kanboard\Api\Middleware\AuthenticationMiddleware. Another middleware CORSMiddleware could be added.
Updating jsonrpc.php is fine too if adding a new middleware is overkill. Another possibility is to update the vendored library lib/jsonrpc. The important part is to make it configurable.
When trying to use the Kanboard API with Axios from a different origin (e.g., http://localhost:8081), I encounter a CORS policy issue. The browser blocks the request due to the absence of the Access-Control-Allow-Origin header in the response from jsonrpc.php.
Error Message:
Proposed Solution:
To solve this issue, I suggest adding the following headers to
jsonrpc.php
:kanboard/jsonrpc.php
Lines 1 to 5 in bc2d336
The change look like this
Security Considerations:
Before adding these headers, I'd like to discuss potential security implications. Are there any concerns with allowing cross-origin requests from any domain (*)? Should we restrict the allowed origins to specific domains or implement additional security measures?
Please let me know if this draft issue meets your requirements or if you'd like me to make any changes!
The text was updated successfully, but these errors were encountered: