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

Can't access the server from localhost on a different port in a browser #75

Closed
AeromeFileManager opened this issue Apr 28, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@AeromeFileManager
Copy link

Hey, I was playing around with writing a client for querying Cozo in the browser.

The problem is that the /text-query endpoint requires a JSON value to be passed, but I can't set the Content-Type header because the CorsLayer in your server doesn't allow for any headers to be set. I believe this will also disallow the x-cozo-auth header from being set on cross origin requests from the browser as well.

Adding the following line to the CorsLayer instantiation fixed the issue, and will allow for the auth header as well.

    .allow_headers([header::CONTENT_TYPE, HeaderName::from_static("x-cozo-auth")])

I can make a pull request if you like.

As an aside, thanks for doing Cozo! It looks great, I'm going to use it in lieu of SQLite in my file manager project and see how it goes.

@zh217
Copy link
Contributor

zh217 commented Apr 29, 2023

I haven't had the opportunity to look at this yet. If you're able to create a pull request, I would greatly appreciate it! Thank you in advance for your contribution.

zh217 added a commit that referenced this issue May 2, 2023
@zh217 zh217 added the enhancement New feature or request label May 8, 2023
@zh217 zh217 closed this as completed May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants