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

Adding dynamic RoutePrefixes support #3150

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

Conversation

davesmits
Copy link

@davesmits davesmits commented Nov 16, 2024

Pull Request

The issue or feature being addressed

Fixes #3144

Details on the issue fix or feature implementation

Adding callback to give a valid routeprefix based on the http context

Comment on lines 81 to +86
if (HttpMethods.IsGet(httpMethod))
{
var path = httpContext.Request.Path.Value;

// If the RoutePrefix is requested (with or without trailing slash), redirect to index URL
if (Regex.IsMatch(path, $"^/?{Regex.Escape(_options.RoutePrefix)}/?$", RegexOptions.IgnoreCase))
if (Regex.IsMatch(path, $"^/?{Regex.Escape(routePrefix)}/?$", RegexOptions.IgnoreCase))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was thinking more something like Func<HttpContext, bool> or Func<HttpRequest, bool> to match against, then it doesn't necessarily have to be something to do with Regex if the user wants something custom.

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.

[Bug]: SwaggerUIMiddleware is now internal
2 participants