Azure / Azure/azure-functions-openapi-extension
Support for X-Forwarded-Host
- Dominant language
- C#
- Stars
- 388
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the issue**
We have Function Apps that are accessed through a Front Door. This gives us some trouble with the URL in the swagger UI as the URL is being resolved to the direct URL of the Function App which is not what we want as it is not accessible and everything should go through the Front Door. Is there a way to configure the URL being set in the Swagger UI? As far as I can tell this is the logic that sets it and it doesn't appear there is a way to change it: https://github.com/Azure/azure-functions-openapi-extension/blob/ab184cbf3c8ff16378cfa00fa1cb23cb58ac1727/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/SwaggerUI.cs#L61
I know that the Front Door will send X-Forwarded-Host and X-Forwarded-Proto which we were able to use with older the older Swashbuckle library which we used for In-Process Function Apps.
**To Reproduce**
Steps to reproduce the behavior:
1. Deploy Function App
2. Configure Front Door
3. Try to access Swagger UI through Front Door
4. Observe non-Front Door URL being used
**Expected behavior**
Front Door URL should be used
**Screenshots**

Contributor guide
Research direction
Start with src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/SwaggerUI.cs at line 61 and reproduce the Swagger UI URL behavior through Azure Front Door. Check how the reported X-Forwarded-Host and X-Forwarded-Proto values relate to the generated URL; done means the Front Door URL is used instead of the direct Function App URL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100