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 is not supported by JSON gRPC gateway #10983

Closed
kghost opened this issue Aug 5, 2019 · 4 comments
Closed

CORS is not supported by JSON gRPC gateway #10983

kghost opened this issue Aug 5, 2019 · 4 comments
Assignees

Comments

@kghost
Copy link

kghost commented Aug 5, 2019

Step to reproduce:

start etcd with CORS:

etcd --cors '*'

check CORS:

% curl -X OPTIONS http://localhost:2379/v3beta/kv/range -v -H 'Origin: http://example.com'
*   Trying 127.0.0.1:2379...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 2379 (#0)
> OPTIONS /v3beta/kv/range HTTP/1.1
> Host: localhost:2379
> User-Agent: curl/7.65.1
> Accept: */*
> Origin: http://example.com
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 405 Method Not Allowed
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Mon, 05 Aug 2019 13:40:42 GMT
< Content-Length: 19
< 
Method Not Allowed
* Connection #0 to host localhost left intact

And CORS only set up on 404 request:

% curl -X OPTIONS http://localhost:2379/404 -v -H 'Origin: http://example.com'
*   Trying 127.0.0.1:2379...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 2379 (#0)
> OPTIONS /404 HTTP/1.1
> Host: localhost:2379
> User-Agent: curl/7.65.1
> Accept: */*
> Origin: http://example.com
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Access-Control-Allow-Headers: accept, content-type, authorization
< Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE
< Access-Control-Allow-Origin: *
< Date: Mon, 05 Aug 2019 13:41:05 GMT
< Content-Length: 0
< 
* Connection #0 to host localhost left intact
@kghost kghost changed the title CORS is not support by JSON gRPC gateway CORS is not supported by JSON gRPC gateway Aug 5, 2019
@hexfusion hexfusion self-assigned this Aug 6, 2019
@hexfusion
Copy link
Contributor

Thanks for the report we can look at adding this support.

@hexfusion hexfusion added this to the etcd-v3.5 milestone Aug 6, 2019
@kghost
Copy link
Author

kghost commented Aug 7, 2019

I found it is already implemented in master branch, is it going to backport to 3.3 branch ?

@hexfusion hexfusion removed this from the etcd-v3.5 milestone Aug 7, 2019
@hexfusion
Copy link
Contributor

I found it is already implemented in master branch, is it going to backport to 3.3 branch ?

You are correct, but as this is a feature in 3.4 [1],[2] that requires server flag param we probably can not backport. Reason being some 3.3.x server would support the flag while others would not. In the later case, it could cause etcd to not start if the flag were passed.

[1] #9490
[2] https://github.com/etcd-io/etcd/blob/master/CHANGELOG-3.4.md#security-authentication

@stale
Copy link

stale bot commented Apr 6, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 6, 2020
@stale stale bot closed this as completed Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants