0

Мы реализовали Identity Server с использованием IdentityServer4 и развернули его в AWS. Он отлично работает, пока мы не включили https на ELB. Теперь, когда клиент пытается аутентифицироваться, мы получаем следующую ошибку:Получение «IDX10108: указанный адрес недействителен в соответствии с схемой HTTPS» при вызове IdentityServer4 в AWS

Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[0] 
    An unhandled exception has occurred while executing the request 
System.InvalidOperationException: IDX10803: Unable to obtain configuration from: 'https://int.mycompany.com/.well-known/openid-configuration'. ---> System.ArgumentException: IDX10108: The address specified is not valid as per HTTPS scheme. Please specify an https address for security reasons. If you want to test with http address, set the RequireHttps property on IDocumentRetriever to false. 

Из того, что я прочитал, клиент не устраивает сертификат. Это может быть связано с именем хоста сервера идентификации и именем в сертификате. У нас есть действительный шаблонный знак с темой «* .mycompany.com». Мы сконфигурировали клиента с полномочием как «https://int.mycompany.com», чтобы он выглядел как линейный.

Я также прочитал в этой конфигурации балансировки нагрузки, что некоторые заголовки должны быть перенаправлены на промежуточное ПО, но я не совсем уверен, как это будет работать.

ответ

0

Похоже, что запрос HTTPS не признается таковым. Попробуйте добавить следующие параметры в ConfigureServices метод в Startup классе:

services.Configure<ForwardedHeadersOptions>(options => 
{ 
    options.ForwardedHeaders = ForwardedHeaders.XForwardedProto; 
}); 

От HTTP Headers and Elastic Load Balancing AWS документация:

The X-Forwarded-Proto request header helps you identify the protocol (HTTP or HTTPS) that a client used to connect to your server. Your server access logs contain only the protocol used between the server and the load balancer; they contain no information about the protocol used between the client and the load balancer. To determine the protocol used between the client and the load balancer, use the X-Forwarded-Proto request header. Elastic Load Balancing stores the protocol used between the client and the load balancer in the X-Forwarded-Proto request header and passes the header along to your server.