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

CORS in not allowed for /api/v2/query endpoint #18391

Closed
sranka opened this issue Jun 8, 2020 · 0 comments · Fixed by #18410
Closed

CORS in not allowed for /api/v2/query endpoint #18391

sranka opened this issue Jun 8, 2020 · 0 comments · Fixed by #18410
Assignees

Comments

@sranka
Copy link
Contributor

sranka commented Jun 8, 2020

The CORS handling is not implemented for /api/v2/query endpoint of InfluxDB v1.

  • this code should be added for /api/v2/query and /api/v2/write paths , but it is not
  • the v1 CORS handler must also allow 'User-Agent' header to be sent by the client

Steps to reproduce:

  1. Run the browser example from https://github.com/influxdata/influxdb-client-js/tree/master/examples
  2. Change url in index.html therein to point to a remote instance, it can be http://localhost:8086
  3. Try to write or query data using the buttons on the page
    Expected behavior:
    It works.

Actual behavior:
It fails with:

Access to fetch at 'http://localhost:8086/api/v2/query?org=my-org' from origin 'http://localhost:3001' 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. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Environment info:

  • System info: any
  • InfluxDB version: 1.8.0, the 2020-06-08 master1.x does not work as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant