- ABP Framework version: v8.3.0
- UI Type: Angular
- Database System: EF Core (SQL Server.)
- Tiered (for MVC) or Auth Server Separated (for Angular): yes
- Exception message and full stack trace:none
- Steps to reproduce the issue: Hi, Layered Solution Architecture How to add API gateway, I want to proxy the api through the gateway in order to provide services to the outside world, currently I follow Microservice template to create my gateway project, it successfully proxies hostapi service but it is not able to get authorization for authserver what should I do with it, can it be proxied through the gateway?
"ReverseProxy": {
"Routes": {
"UnifiedApi": {
"ClusterId": "HostApiServer",
"Match": {
"Path": "/api/{**catch-all}"
}
},
"UnifiedApiSwagger": {
"ClusterId": "HostApiServer",
"Match": {
"Path": "/swagger-json/HostApiServer/swagger/v1/swagger.json"
},
"Transforms": [
{ "PathRemovePrefix": "/swagger-json/HostApiServer" }
]
},
//// 授权服务的路由
//"AuthServerWellKnown": {
// "ClusterId": "AuthServer",
// "Match": {
// "Path": "/.well-known/openid-configuration"
// },
// "Order": 1
//},
//"AuthServerConnectEndpoints": {
// "ClusterId": "AuthServer",
// "Match": {
// "Path": "/connect/{**catch-all}"
// },
// "Order": 2
//}
},
"Clusters": {
"HostApiServer": {
"Destinations": {
"HostApiServer": {
"Address": "http://localhost:44362/"
}
}
},
//"AuthServer": {
// "Destinations": {
// "AuthServer": {
// "Address": "http://localhost:44333/"
// }
// }
//}
}
5 Answer(s)
-
0
hi
I want to proxy the api through the gateway
Gateway is like a reverse proxy server.
Your auth server is
localhost:44333,
but your swagger website can't reach the auth server.Is
localhost:44333
available? -
0
hi
I want to proxy the api through the gateway
Gateway is like a reverse proxy server.
Your auth server is
localhost:44333,
but your swagger website can't reach the auth server.Is
localhost:44333
available?I think I've solved it, I've proxied both authserver and hostapi through gateway, and now I'm left with the last one, and I don't know why I'm getting multiple inputs.
if (IsSwaggerEnabled(configuration)) { app.UseSwagger(); app.UseAbpSwaggerUI(options => { ConfigureSwaggerUI(proxyConfig, options, configuration); }); app.UseRewriter(CreateSwaggerRewriteOptions()); } private static bool IsSwaggerEnabled(IConfiguration configuration) { return bool.Parse(configuration["Swagger:IsEnabled"] ?? "true"); } private void ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration) { if (IsSwaggerEnabled(configuration)) { context.Services.AddAbpSwaggerGen(); } } private static void ConfigureSwaggerUI( IProxyConfig proxyConfig, SwaggerUIOptions options, IConfiguration configuration) { foreach (var cluster in proxyConfig.Clusters) { options.SwaggerEndpoint($"/swagger-json/{cluster.ClusterId}/swagger/v1/swagger.json", $"{cluster.ClusterId} API"); } options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); options.OAuthScopes( "Unified" ); }
-
0
hi
Can you check the swagger html page? Maybe it loaded some javascript files multiple times.
-
0
Gateway is like a reverse proxy server.
thank u,it's worked, I'm just using the gateway as a proxy, I don't need to use swagger like microservices, previously I referenced the microservices template.
-
0
: )