2

Here is my CORS policy set to have a custom header

return http.ListenAndServe(":"+port,
        handlers.CORS(handlers.AllowedHeaders([]string{"X-Requested-With", "Content-Type", "Authorization","Custom-header"}),
            handlers.AllowedMethods([]string{"GET", "POST", "PUT", "DELETE"}),
            handlers.AllowedOrigins([]string{"*"}))(mux))

And now in my grpc server, when the call hits I am trying to read the header using below code snippet

md, ok := metadata.FromIncomingContext(ctx)
    if !ok {
        fmt.Println(fmt.Sprintf("%v", ok))
    }

    fmt.Println(fmt.Sprintf("%v", md))

However, the header Authorization is getting from the metadata, but the Custom-header is not showing up. How do I get my Custom-header and its value?

0 Answers0