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

Add processing for route prefixes, external urls, and pprof mux #293

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kwilt
Copy link
Contributor

@kwilt kwilt commented Feb 6, 2025

Supporting pull request for prometheus/snmp_exporter#1335

Maybe this sucks, idk. I'm getting out of my comfort zone with this pull request lol. But I gave it a shot anyway. 😬

This is my attempt at moving a good chunk of the routing for the exporter into the landing page's codebase. In theory this could make a more cohesive experience across exporters and allow for easier development as most of the routing work is now done by using the LandingConfig struct.

…serving the pprof endpoints accessible on the landing page

Signed-off-by: kwilt <[email protected]>
// Ensure Path component of ExternalURL is formatted without trailing slashes,
// contains a leading slash, and is not empty
pathPrefix := strings.TrimRight(parsedExternalURL.Path, "/")
if pathPrefix != "" && !strings.HasPrefix(pathPrefix, "/") {

Check warning

Code scanning / CodeQL

Bad redirect check Medium

This is a check that
this value
, which flows into a
redirect
, has a leading slash, but not that it does not have '/' or '' in its second position.
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.

1 participant