vault/http
Christopher Swenson 4a5cde0afb
Forward websocket event subscription requests (#22446)
For now, only the leader of a cluster can handle subscription requests,
so we forward the connection request otherwise.

We forward using a 307 temporary redirect (the fallback way).
Forwarding a request over gRPC currently only supports a single request
and response, but a websocket connection is long-lived with potentially
many messages back and forth.

We modified the `vault events subscribe` command to honor those
redirects. `wscat` supports them with the `-L` flag.

In the future, we may add a gRPC method to handle forwarding WebSocket
requests, but doing so adds quite a bit of complexity (even over
normal request forwarding) due to the intricate nature of the `http` /
`vault.Core` interactions required. (I initially went down this path.)

I added tests for the forwarding header, and also tested manually.
(Testing with `-dev-three-node` is a little clumsy since it does not
properly support experiments, for some reason.)

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
2023-08-22 14:33:31 -07:00
..
web_ui Make web_ui complient with Go's native embedding (#14246) 2022-02-24 09:12:36 -05:00
assets.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
assets_stub.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
auth_token_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
cors.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
custom_header_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
events.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
events_test.go Forward websocket event subscription requests (#22446) 2023-08-22 14:33:31 -07:00
forwarded_for_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
forwarding_bench_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
forwarding_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
handler.go Forward websocket event subscription requests (#22446) 2023-08-22 14:33:31 -07:00
handler_stubs_oss.go Chroot Listener (#22304) 2023-08-14 12:35:34 -07:00
handler_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
help.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
help_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
http_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
logical.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
logical_test.go VAULT-19046: Audit eventlogger escape hatch (#22344) 2023-08-17 21:20:30 +01:00
plugin_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_audit_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_auth_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_config_cors_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_config_state_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_feature_flags.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_generate_root.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_generate_root_test.go VAULT-19046: Audit eventlogger escape hatch (#22344) 2023-08-17 21:20:30 +01:00
sys_health.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_health_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_hostinfo_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_in_flight_requests.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_in_flight_requests_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_init.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_init_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_internal_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_leader.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_leader_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_lease_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_metrics.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_metrics_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_monitor_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_mount_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_mounts_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_policy_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_raft.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_rekey.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_rekey_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_rotate_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_seal.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_seal_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
sys_wrapping_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
testing.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
unwrapping_raw_body_test.go [COMPLIANCE] License changes (#22290) 2023-08-10 18:14:03 -07:00
util.go Chroot Listener (#22304) 2023-08-14 12:35:34 -07:00