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

Relative Paths problem in Azure East/West deployment #990

Open
mattisking opened this issue Mar 8, 2022 · 1 comment
Open

Relative Paths problem in Azure East/West deployment #990

mattisking opened this issue Mar 8, 2022 · 1 comment
Labels

Comments

@mattisking
Copy link

Please, fill the following sections to help us fix the issue

What happened: TLDR: The code that works out full paths from relative paths for the healthcheck in the healthcheck-ui isn't quite working when deployed as an App Service in Azure. This results in a "System.Net.Sockets.SocketException" "No such host is known." every time the UI calls the healthcheck.
"HealthChecksUI": {
"HealthChecks": [
{
"Name": "HealthChecksService",
"Uri": "/healthcheck"
}
],
"Webhooks": [],
"EvaluationTimeinSeconds": 10
},

GetHealthReport threw an exception when trying to get report from /healthcheck configured with name HealthChecksService.

This results in the UI failing to pull any health report.

What you expected to happen: I'd expect a health report.

How to reproduce it (as minimally and precisely as possible):

  1. Use a config like above.
  2. Deploy to Azure as an App Service.

Source code sample: I can create a sample if needed, but even the samples will do the same.

Anything else we need to know?: I am specifically using 3.1.3 of the libraries. Since it's Azure and an App Service it's not using Kestrel, it's using IIS.

I pulled down the code for 3.1.3, removed the nuget references and added UI, UI.Client, and UI.Core to my project and added it as a project reference, cleaning that up to build in our project and aligning .Net Core libraries and references. I also modified:
HealthChecks.UI
Core/HostedService/HealthCheckReportCollector.cs
private async Task GetHealthReport(HealthCheckConfiguration configuration)
in the exception to be a little more useful:
108: _logger.LogError(exception, $"GetHealthReport threw an exception when trying to get report from {uri} configured with name {name}: absoluteUri: {absoluteUri}.");
... by adding the Uri it's trying to use after working out the relative paths.

What's happening is this:
We have an east and west and the Azure generated URL for each is this:
https://oursite-dev-east-site.azurewebsites.net/
https://oursite-dev-west-site.azurewebsites.net/

So, I'd expect when I use /healthcheck I'd get:
https://oursite-dev-east-site.azurewebsites.net/healthcheck
https://oursite-dev-west-site.azurewebsites.net/healthcheck

But in fact, the relative path is being worked out as:
https://oursite-dev-east-site/healthcheck
https://oursite-dev-west-site/healthcheck

It's missing ".azurewebsites.net" so the httpclient is failing with "No Such Host."

**I'd recommend adding absoluteUri to the error logging as that's clearly something that's needed here when things fail.

Environment: Azure East/West typical App Service deployment.

  • .NET Core version 3.1
  • Healthchecks version 3.1.3
  • Operative system: Windows
  • Others:
@Ericvf
Copy link

Ericvf commented Mar 31, 2023

It might be related to this as well: #1779

@sungam3r sungam3r added the UI label Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants