Skip to content

cors issue #1636

Open
Open
@yovanoc

Description

@yovanoc

Bug Report

Version

├── tonic v0.11.0
├── tonic-web v0.11.0
│   ├── tonic v0.11.0 (*)
└── tonic-build v0.11.0

Platform

Darwin mbp-1.home 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:10 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6031 arm64

Description

I tried this code:

  let server = HealthServer { addr };

  let svc = pb::health_server::HealthServer::with_interceptor(server, check_auth);

  let cors = CorsLayer::new()
            .allow_headers(Any)
            .allow_methods([Method::GET, Method::POST])
            .allow_origin(Any);

        let serve = Server::builder()
            .trace_fn(|_| tracing::info_span!("health_server"))
            .accept_http1(true)
            .layer(cors)
            .layer(GrpcWebLayer::new())
            .add_service(svc)
            .serve(addr);

I expected to see this happen: should build

Instead, this happened:
Screenshot 2024-02-20 at 13 27 22

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions