From b5613150cc341b1c9fa4c667ad6370a039176575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Sat, 30 Mar 2024 17:14:06 +0100 Subject: [PATCH] Use webProxy for IONOS (https://www.ionos.de/hilfe/index.php?id=4426) --- .../Controllers/PullRequestStatusCheckController.cs | 2 +- Source/Testably.Server/Program.cs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Testably.Server/Controllers/PullRequestStatusCheckController.cs b/Source/Testably.Server/Controllers/PullRequestStatusCheckController.cs index c8dae7c..a283a12 100644 --- a/Source/Testably.Server/Controllers/PullRequestStatusCheckController.cs +++ b/Source/Testably.Server/Controllers/PullRequestStatusCheckController.cs @@ -60,7 +60,7 @@ public async Task OnPullRequestChanged( return BadRequest($"Only public repositories from '{RepositoryOwner}' are supported!"); } - using var client = _clientFactory.CreateClient(); + using var client = _clientFactory.CreateClient("Proxied"); var owner = pullRequestModel.Payload.Repository.Owner.Login; var repo = pullRequestModel.Payload.Repository.Name; diff --git a/Source/Testably.Server/Program.cs b/Source/Testably.Server/Program.cs index 7c9e709..caff743 100644 --- a/Source/Testably.Server/Program.cs +++ b/Source/Testably.Server/Program.cs @@ -1,3 +1,4 @@ +using System.Net; using System.Reflection; using System.Text.Json; using Serilog; @@ -14,8 +15,13 @@ public static void Main(string[] args) var builder = WebApplication.CreateBuilder(args); + var webProxy = new WebProxy("http://winproxy.server.lan:3128"); // Add services to the container. - builder.Services.AddHttpClient(); + builder.Services.AddHttpClient("Proxied") + .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler() + { + Proxy = webProxy + }); builder.Services.AddRazorPages(); builder.Services.AddControllers() .AddJsonOptions(o