-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Use headers for routing #157
Comments
I never add the feature unless it is "standardized" in googleapis repo or I realize that the use case is common enough. In my understanding, such custom dispatch tends to be implemented as a custom Also if we really need this kind of "pattern matching", we would also need to discuss what kind of inputs should be involved into the pattern match. Why is it applied to only headers? Why not match with query parameters? For uncommon use cases, you can combine any custom Go http handler with top of the one func TagVerbFilter(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request){
if r.Header.Get("foo") == "bar" && r.Header.Get("other") == "val" {
r2 := new(http.Request)
*r2 = *r
u, err := url.Parse(r.URL.String() + ":myVerb"
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
r2.URL = u
r = r2
}
h.ServeHTTP(w, r)
})
} |
Just doing a little bit of tidying. I hope that your question was answered in a way that let your project continue. If you have any more questions feel free to open another issue. |
Some RPC systems like those used by AWS expect a header to determine the method being invoked. It doesn't look like this is actually part of the google protobuf option used to generate the proxy, but I had envisioned something like headers: [["foo", "bar"], ["other", "val"]] which would allow me to trigger routing if the header foo=bar and other=val. Is this the right place to discuss something like this, or should I make an issue in the googleapis repo?
The text was updated successfully, but these errors were encountered: