Skip to content

Commit be64452

Browse files
committed
add "bypass-tunnel-reminder" header
1 parent e51c542 commit be64452

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/Backend/Program.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
.AddHttpClient()
77
.Build();
88

9-
app.UseCors();
9+
app.UseCors(builder => builder
10+
.WithOrigins("https://capybara-pro-code.github.io")
11+
.AllowAnyHeader()
12+
.AllowAnyMethod());
1013
app.UseRouting();
1114
app.UseMetricServer();
1215
app.MapGet("/", () => new ApplicationInfoDto(Constants.ApplicationStartDate));

src/Frontend/Program.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
builder.Services.AddScoped<RenewBackendUrlHandler>();
1111
builder.Services.AddScoped<BackendService>();
12-
builder.Services.AddScoped(_ => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
12+
builder.Services.AddScoped(_ => new HttpClient {
13+
BaseAddress = new Uri(builder.HostEnvironment.BaseAddress),
14+
DefaultRequestHeaders = {
15+
{ "bypass-tunnel-reminder", "true" }
16+
}
17+
});
1318

1419
await builder.Build().RunAsync();

src/Frontend/Services/BackendService.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ public class BackendService : IDisposable {
77
private readonly HttpClient _httpClient;
88

99
public BackendService(RenewBackendUrlHandler renewBackendUrlHandler) {
10-
_httpClient = new HttpClient(renewBackendUrlHandler) { BaseAddress = new Uri("https://lhr.life") };
10+
_httpClient = new HttpClient(renewBackendUrlHandler) {
11+
BaseAddress = new Uri("https://lhr.life"),
12+
DefaultRequestHeaders = { { "bypass-tunnel-reminder", "true" } }
13+
};
1114
}
1215

1316
public async Task<DateTimeOffset> GetApplicationStartDate() {

0 commit comments

Comments
 (0)