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

Unable to perform any non-GET request due to CORS #4601

Open
davidMcneil opened this issue Aug 18, 2018 · 2 comments
Open

Unable to perform any non-GET request due to CORS #4601

davidMcneil opened this issue Aug 18, 2018 · 2 comments
Labels
good first issue stage/needs-verification Issue needs verifying it still exists theme/api HTTP API and SDK issues type/enhancement

Comments

@davidMcneil
Copy link

If you have a question, prepend your issue with [question] or preferably use the nomad mailing list.

If filing a bug please include the following:

Nomad version

Nomad v0.8.4 (dbee1d7)

Operating system and Environment details

Ubuntu 16.04

Issue

When attempting to perform a non-GET request to the http api from a browser, I recieve the following error:

OPTIONS http://localhost:9878/v1/job/gc 

Fetch API cannot load http://localhost:9878/v1/job/gc. Response to preflight request doesn't pass access 
control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 
'http://localhost:1234' is therefore not allowed access. The response had HTTP status code 404. If an 
opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS 
disabled.

I have the following in my config file:

http_api_response_headers {
  "Access-Control-Allow-Origin" = "*"
  "Access-Control-Allow-Methods" = "POST, GET, OPTIONS, PUT, DELETE"
  "Access-Control-Allow-Headers" = "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization"
}

Reproduction steps

Try and perform an non-GET http request from the browser.

Nomad Server logs (if appropriate)

Nomad Client logs (if appropriate)

Job file (if appropriate)

@davidMcneil
Copy link
Author

I believe it is because the OPTIONS method is not correctly supported. I believe the consul fix was here hashicorp/consul#3885

@DerekStrickland
Copy link
Contributor

Is this still actively desired?

@tgross tgross added this to Needs Roadmapping in Nomad - Community Issues Triage Feb 12, 2021
@tgross tgross added the stage/needs-verification Issue needs verifying it still exists label Mar 3, 2021
@tgross tgross removed this from Needs Roadmapping in Nomad - Community Issues Triage Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue stage/needs-verification Issue needs verifying it still exists theme/api HTTP API and SDK issues type/enhancement
Projects
None yet
Development

No branches or pull requests

4 participants