Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CORS #38

Open
sytolk opened this issue Jul 6, 2022 · 0 comments
Open

Support CORS #38

sytolk opened this issue Jul 6, 2022 · 0 comments

Comments

@sytolk
Copy link

sytolk commented Jul 6, 2022

How can I easily set Access-Control-Allow-Origin header in Apache webdav config?
Maybe we can have SUPPORT_CORS boolean environment and add (Access-Control-Allow-Origin: *) rule to the response header.
And OPTIONS request needs to be not Authenticated - it is for initial CORS preflight request and if its need Authentication for OPTIONS the error will be:

Access to XMLHttpRequest at 'http://localhost:9988/' from origin 'http://localhost:8000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

The reson for this is HTTP 401 status from preflight request

curl -XOPTIONS -H "Access-Control-Request-Method: GET" -H "Origin: http://localhost:8000" --head http://localhost:9988/webdav/server
HTTP/1.1 401 Unauthorized
Date: Wed, 06 Jul 2022 15:03:32 GMT
Server: Apache/2.4.37 (Unix)
Access-Control-Allow-Origin: http://localhost:8000
Access-Control-Allow-Methods: GET, HEAD, POST, PUT, OPTIONS, MOVE, DELETE, COPY, LOCK, UNLOCK, PROPFIND
Access-Control-Allow-Headers: origin, content-type, cache-control, accept, authorization, if-match, destination, overwrite
WWW-Authenticate: Basic realm="WebDAV"
Content-Length: 381
Content-Type: text/html; charset=iso-8859-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant