我需要更改发现端点的url如下:
/.well-known/openid-configuration
到此:
/identity/.well-known/openid-configuration
我正在尝试将ID4部署到Azure Kubernetes服务。当我将ID4部署到根地址(比如http://xxxx.europe.cloudapp.azure.com)-我看到欢迎页面,可以访问我的发现端点。
但是,当我将ID4部署到子例程时(http://xxxx.europe.cloudapp.azure.com/identity)我无法访问oidc配置。我正在使用URL重写,因此当我单击链接访问发现文档时(http://xxxx.europe.cloudapp.azure.com/identity/.well-known/openid-configuration)我得到HTTP404。
编辑:
当我添加:
app.Use(async (context, next) =>
{
context.Request.PathBase = "/identity";
await next.Invoke();
});
所有css/js/jpeg文件都已正确加载。这就是进步。
但是,当我点击欢迎页面上可见的链接时((http://xxxx.europe.cloudapp.azure.com/identity/.well-known/openid-configuration)我得到HTTP404。当我点击grants时((http://xxxx.europe.cloudapp.azure.com/identity/grants)。这是同一个故事。手动从链接中删除"/inidentity"仍然会导致404。
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.Map("/identity", authApp =>
{
app.UseStaticFiles("/identity");
authApp.UsePathBase(new PathString("/identity"));
authApp.UseIdentityServer();
});
}
- Github问题
- 在将IS4部署到子例程后无法到达发现端点·问题#2920·IdentityServer/IdentityServer4
编辑:
也尽量不要使用
app.UseHttpsRedirection()
将HTTPS留给代理服务器
您应该能够通过在IApplicationBuilder
上使用Map
Api来使用相对URI。
app.Map("/identity", authApp =>
{
authApp.UseIdentityServer();
});
多亏了Vidmantas和Mohamed的回答,我才得以成功。我采纳了他们的建议,以下是我最终成功的原因:
app.Map("/identity", authApp =>
{
authApp.UseStaticFiles();
authApp.UseIdentityServer();
authApp.UseMvcWithDefaultRoute();
});
不知怎的,没有它就不能正常工作
authApp.UseMvcWithDefaultRoute();
我在istio网关配置中遇到了一些问题。在解决了这些问题后,IS4就像子程序中的符咒一样工作。谢谢你们的回答。