Angular等于c#' s&quot usepathbase;
我们在AWS ALB背后有一个角度应用。当提出请求到某个路由example.com/balancer-route/....时,负载平衡器将流量引导到Angular应用程序。但这意味着请求在URI中使用其他
balancer-route
击中Angular应用程序。我们需要忽略这些内容,以便正确提供文件。
C#中的app.usebasepath
是否等效?在C#中,这将必不可少/Balancer-Route
一部分请求,而是正常的端点。当不存在基本路径时,它也将继续提供请求。
我们知道可以使用NGINX解决这可以解决,但是希望在运行时将路径传递给应用程序的基于应用程序的解决方案。
We have an angular application behind an AWS ALB. The load balancer directs traffic to the angular app when requests are made to a certain route example.com/balancer-route/...
. But this then means that requests hit the angular app with the additional balancer-route
in the URI. We need these to be ignored so files are served correctly.
Is there an equivalent to app.UseBasePath
in C#? In C# this would essential ignore the /balancer-route
part of the requests and serve the endpoints as normal. It would also continue to serve requests when the base path is not present.
We're aware this can be solved using NGINX but would prefer an application based solution where the path could be passed to the application at runtime.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过使用重定向角路由功能,您可以获得所需的内容。
以此路线为例:
您可以向
http://some.com/
,http://some.com/quotes
和> http:// some.com/quote/1
,您要重定向到
http://some.com/balancer-route
,http://some.com /balancer-route/quotes
和http://some.com/balancer-route/quote/1
分别分别为第一个路由示例。因此,我们将所有路由将所有路线与儿童路线分组为一个对象,我们将在对所有路线分组的同一对象中添加另一条路线
By using the redirect capabilities of Angular Routing you can get what you are looking for.
Take this routes for example:
you can surf to
http://some.com/
,http://some.com/quotes
andhttp://some.com/quote/1
,and, you want to redirect to traffic from
http://some.com/balancer-route
,http://some.com/balancer-route/quotes
andhttp://some.com/balancer-route/quote/1
to the first routes examples respectively.Therefore we will group all our Routes into one object with children routes, and we will add another Route with reidrect to the same object that groups all the routes