-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure HTTPS health probes and secure internal health endpoints (#521
) ### Summary & Motivation Configure Azure Container Apps HTTPS health probes for the Account Management and Back Office API and Workers for Live and Readiness health checks. AppGateway will continue using TCP health probes. Initially, Azure Container App uses a QuickStart Image that lacks HTTP health endpoints. Therefore, HTTP health endpoints are configured only after infrastructure deployment when a self-contained system with health endpoints is deployed. Relocate health endpoints to `[self-contained-system]/internal-api/live` and `[self-contained-system]/internal-api/readiness`. Create a new `RequestTransformation` in YARP AppGateway to block all traffic to any path containing `/internal-api/`, ensuring that health endpoints are not publicly accessible but can be only accessed internally by Azure Container Apps. ### Checklist - [x] I have added a Label to the pull-request - [x] I have added tests, and done manual regression tests - [x] I have updated the documentation, if necessary
- Loading branch information
Showing
7 changed files
with
86 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
application/AppGateway/Transformations/BlockInternalApiTransform.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Yarp.ReverseProxy.Transforms; | ||
|
||
namespace PlatformPlatform.AppGateway.Transformations; | ||
|
||
public class BlockInternalApiTransform : RequestTransform | ||
{ | ||
public override async ValueTask ApplyAsync(RequestTransformContext context) | ||
{ | ||
if (context.HttpContext.Request.Path.Value?.Contains("/internal-api/", StringComparison.OrdinalIgnoreCase) == true) | ||
{ | ||
context.HttpContext.Response.StatusCode = StatusCodes.Status403Forbidden; | ||
context.HttpContext.Response.ContentType = "text/plain"; | ||
await context.HttpContext.Response.WriteAsync("Access to internal API is forbidden."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters