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

My websocket request returns 400 with header Connection: keep-alive, websocket #5957

Open
blue-hope opened this issue Oct 24, 2024 · 0 comments · May be fixed by #5958
Open

My websocket request returns 400 with header Connection: keep-alive, websocket #5957

blue-hope opened this issue Oct 24, 2024 · 0 comments · May be fixed by #5958

Comments

@blue-hope
Copy link

Error message

The upgrade header must contain:
  Upgrade: websocket
  Connection: Upgrade

Environment

  • Armeria 1.26.0
  • Spring Boot 3.0.5

Websocket Handler

// ArmeriaConfig.kt
@Configuration
class ArmeriaConfig {
    @Bean
    fun armeriaServerConfigurator(
        grpcServiceBuilder: GrpcServiceBuilder,
        webSocketServiceBuilder: WebSocketServiceBuilder,
        healthCheckService: HealthCheckService,
        webProperties: WebProperties
    ): ArmeriaServerConfigurator = ArmeriaServerConfigurator { serverBuilder ->
        serverBuilder
            .service(
                grpcServiceBuilder
                    .build(),
            )
            .serviceUnder(
                "/ws",
                webSocketServiceBuilder.build()
            )
    }

Request message

$ curl --request GET \
  --url http://localhost:8080/ws/test \
  --header 'Host: <Host>' \
  --header 'Origin: http://localhost:8080' \
  --header 'Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits' \
  --header 'Sec-WebSocket-Key: <Key>' \
  --header 'Sec-WebSocket-Version: 13' \
  --header 'Upgrade: websocket' \
  --header 'Connection: upgrade, websocket'

=> returns 400

$ curl --request GET \
  --url http://localhost:8080/ws/test \
  --header 'Host: <Host>' \
  --header 'Origin: http://localhost:8080' \
  --header 'Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits' \
  --header 'Sec-WebSocket-Key: <Key>' \
  --header 'Sec-WebSocket-Version: 13' \
  --header 'Upgrade: websocket' \
  --header 'Connection: upgrade'

=> works properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant