Skip to content

Check or emphasize that protobuf endpoints must be rooted at a versioned path #2084

@jpeach

Description

@jpeach

Description

The clutch HTTP muxer checks that gRPC gateway URLs are rooted at the path /v[0-9]+.

var apiPattern = regexp.MustCompile(`^/v\d+/`)

if apiPattern.MatchString(r.URL.Path) || r.URL.Path == "/healthcheck" {
// Serve from the embedded API handler.
a.next.ServeHTTP(w, r)
return
}

This is a trap for young players, and it took me a while to figure out why clutch served a 500 when I used an initial path component of /foo. It would be best if clutch enforced this constraint by inspecting the protobuf types at startup, but otherwise it would be nice to emphasize this in the docs.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions