-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add CORS headers to allow JavaScript applications direct access #335
Comments
I agree, you should be able to configure what header to set here, keeping the current default of no header. |
Yeah this is a good idea, we can add this. |
That's great! Do you need any help? I'm no Go coder, but if you need someone to test it just tell me when. |
What about adding an object to the configuration which allows the headers to be specified in free form, e.g.: {
"http_api_response_headers": {
"Access-Control-Allow-Origin": "*",
"X-XSS-Protection" "1; mode=block",
"X-Frame-Options": "SAMEORIGIN"
}
} Where each specified header is added as an HTTP header response field on all HTTP API endpoint responses. I'll compose a proposal since this approach is trivial. |
As far as I can tell there is no option to enable CORS on the HTTP API. This means that it's not possible to write a JavaScript application that interacts with a Consul agent without also writing a backend for it to tunnel requests through, or making the Consul agent itself serve the application.
I can see how some would prefer not to have CORS enabled by default, but an option to enable it would be very welcome.
Here's an some examples of what I would use it for:
Would it be possible to add an option to make the HTTP API set CORS headers?
The text was updated successfully, but these errors were encountered: