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 Azure App Services middleware #188

Merged
merged 1 commit into from
Oct 12, 2023
Merged

Add Azure App Services middleware #188

merged 1 commit into from
Oct 12, 2023

Conversation

AButler
Copy link
Member

@AButler AButler commented Oct 12, 2023

Azure App Services strips encoded path delimiters (%2F) before sending the request to the underlying server and this cannot currently be disabled. They do add a header that contains the original URL so this middleware restores back the request URL.

For more information see dotnet/aspnetcore#40532
and Azure/azure-functions-host#9402

@AButler AButler force-pushed the app-services-middleware branch from 47d682b to c9d9a54 Compare October 12, 2023 10:07
@AButler AButler merged commit 5133472 into main Oct 12, 2023
2 checks passed
@AButler AButler deleted the app-services-middleware branch October 12, 2023 10:17
@JJong-nl
Copy link

JJong-nl commented Oct 9, 2024

One issue..
The X-Waws-Unencoded-Url contains the PathAndQuery.
The Request.Path must be set with only the AbsolutePath.

if (context.Request.Headers.TryGetValue(UnencodedUrlHeaderName, out var unencodedUrlValue) && unencodedUrlValue.Any())
{
    var uri = new Uri($"https://fake.url{unencodedUrlValue.First()}");
    context.Request.Path = new PathString(uri.AbsolutePath);
}

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.

3 participants