注册网站要多久,内蒙网站设计公司,大岭山镇网站建设,河北邯郸网站建设相关文章#xff1a;.NET 反向代理-YARP.NET 反向代理-YARP 根据域名转发分享一个基于Abp 和Yarp 开发的API网关项目使用 Yarp 做网关YARP#xff08;Yet Another Reverse Proxy#xff09;是使用 .NET 构建的高度可定制的反向代理C# 开源一个基于 yarp 的 API 网关 Demo.NET 反向代理-YARP.NET 反向代理-YARP 根据域名转发分享一个基于Abp 和Yarp 开发的API网关项目使用 Yarp 做网关YARPYet Another Reverse Proxy是使用 .NET 构建的高度可定制的反向代理C# 开源一个基于 yarp 的 API 网关 Demo支持绑定 Kubernetes Service微软的反向代理项目 ReverseProxy 更名为 Yarp.ReverseProxy YARP 作为反向代理中间件那就无可避免需要使用到 Https 去部署项目那 YARP 要怎么去实现呢本来以为 YARP 会有一套自己的实现在翻阅了资料后发现根本不是我想的那样按照 YARP 官方文档的说法是按照 .Net Core 原本的那一套去实现好家伙真的没想到啊下面我贴出官方原文大伙看一看瞧一瞧 IIS就不多说了这个毕竟只能在 windows 上使用下面我说说 在 Kestrel 怎么设置 Https 吧按照我的惯例直接贴配置文件Kestrel: {Endpoints: {MySniEndpoint: {Url: https://*:5209,SslProtocols: [ Tls11, Tls12 ],Sni: {test1.ysmc.net.cn: {Certificate: {Path: [path]\\test1.ysmc.net.cn_server.pfx,Password: pfx密码}},test2.ysmc.net.cn: {Certificate: {Path: [path]\\test2.ysmc.net.cn_server.pfx,Password: pfx密码}}}}},//默认配置当没有配置的时候默认回落到这个配置 Certificates: {Default: {Path: [path]\\test1.ysmc.net.cn_server.pfx,Password: pfx密码}} 因为我们需要配置多个域名所以使用到了 Sni下面是官方对一 Sni 的部分介绍感兴趣的小伙伴可以过去看看传送门https://learn.microsoft.com/zh-cn/aspnet/core/fundamentals/servers/kestrel/endpoints?viewaspnetcore-6.0#sni-in-configuration-1SNI in configurationKestrel supports SNI defined in configuration. An endpoint can be configured with an object that contains a mapping between host names and HTTPS options. The connection host name is matched to the options and they are used for that connection.SniThe following configuration adds an endpoint named that uses SNI to select HTTPS options based on the host name:MySniEndpointHTTPS options that can be overridden by SNI:Certificate configures the certificate source.Protocols configures the allowed HTTP protocols.SslProtocols configures the allowed SSL protocols.ClientCertificateMode configures the client certificate requirements.The host name supports wildcard matching:Exact match. For example, matches .a.example.orga.example.orgWildcard prefix. If there are multiple wildcard matches then the longest pattern is chosen. For example, matches and .*.example.orgb.example.orgc.example.orgFull wildcard. matches everything else, including clients that arent using SNI and dont send a host name.*The matched SNI configuration is applied to the endpoint for the connection, overriding values on the endpoint. If a connection doesnt match a configured SNI host name then the connection is refused.下面一起看看配置后的效果吧非常的完美 整个完整的配置文件我也贴出来吧至于证书怎么申请的大家有域名的可以到域名服务商里申请免费1年期的没有域名的话可以自己改一下hosts 文件 然后自己自签名一个都是可以的appsettings.json{Logging: {LogLevel: {Default: Information,Microsoft.AspNetCore: Warning}},Kestrel: {Endpoints: {MySniEndpoint: {Url: https://*:5209,SslProtocols: [ Tls11, Tls12 ],Sni: {test1.ysmc.net.cn: {Certificate: {Path: [path]\\test1.ysmc.net.cn_server.pfx,Password: pfx密码}},test2.ysmc.net.cn: {Certificate: {Path: [path]\\test2.ysmc.net.cn_server.pfx,Password: pfx密码}}}}},Certificates: {Default: {Path: [path]\\test1.ysmc.net.cn_server.pfx,Password: pfx密码}}},ReverseProxy: {Routes: {baidu: {ClusterId: baidu,Match: {Hosts: [ test1.ysmc.net.cn ],Path: {**catch-all}}},blazor: {ClusterId: blazor,Match: {Hosts: [ test2.ysmc.net.cn ],Path: {**catch-all}}}},Clusters: {baidu: {LoadBalancingPolicy: RoundRobin,Destinations: {baidu: {Address: https://www.baidu.com/}}},blazor: {LoadBalancingPolicy: RoundRobin,Destinations: {blazor: {Address: https://www.blazor.zone/}}}}}
} 原文链接https://www.cnblogs.com/ysmc/p/16717580.html