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

fix: return 404 instead of links page on bad /api/v2 requests #21950

Merged
merged 3 commits into from
Jul 27, 2021

Conversation

williamhbaker
Copy link
Contributor

Closes #21620

In the APIHandler, the serveLinksHandler is incorporated using h.Mount. This causes any arbitrary requests to a subpath of /api/v2 to hit the serveLinksHandler, for example /api/v2/anyrandomthing, or something more confusing like /api/v2/query&foo=bar where the correct request should look like /api/v2/query?foo=bar. These invalid requests will return a successful status code currently.

Changing h.Mount to h.Handle fixes this, so that only requests specifically made to /api/v2 (or /api/v2/) will return the links page. Invalid requests will return a 404 Not Found.

This will also help with #21167

See equivalent PR in IDPE: https://github.com/influxdata/idpe/pull/9069

Copy link
Contributor

@davidby-influx davidby-influx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Successfully merging this pull request may close these issues.

InfluxDB OSS 2.0 REST API sends HTTP 200 OK after a malformed request
2 participants