Skip to content

Commit

Permalink
Merge pull request #31 from dlcs/fix/returnHttps
Browse files Browse the repository at this point in the history
Adding headers to allow https in response
  • Loading branch information
JackLewis-digirati authored Sep 18, 2024
2 parents cc23bfe + 83c6841 commit f51c1ab
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/IIIFPresentation/API/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using API.Features.Storage.Validators;
using API.Infrastructure;
using API.Settings;
using Microsoft.AspNetCore.HttpOverrides;
using Newtonsoft.Json;
using Repository;
using Serilog;
Expand Down Expand Up @@ -32,6 +33,10 @@
builder.Services.AddDataAccess(builder.Configuration);
builder.Services.ConfigureMediatR();
builder.Services.AddHealthChecks();
builder.Services.Configure<ForwardedHeadersOptions>(opts =>
{
opts.ForwardedHeaders = ForwardedHeaders.XForwardedHost | ForwardedHeaders.XForwardedProto;
});

builder.Services.ConfigureHttpJsonOptions( options =>
{
Expand All @@ -43,6 +48,8 @@

var app = builder.Build();

app.UseForwardedHeaders();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
Expand Down

0 comments on commit f51c1ab

Please sign in to comment.