小编Abh*_*nay的帖子

AWS ALB 中基于路径的路由到具有多个端口的单个主机

我想创建一个 ALB,它应该根据到不同网站的路径路由我的流量。例如。

example.com/apple/ 应该转到 8080

example.com/grapes/ 应该转到 8180

example.com/oranges/ 应转到 8280

您能否指导我,我怎样才能实现这一目标。

到目前为止我所尝试的如下。

  1. 在端口 80 上创建侦听器,并为不同端口创建不同的目标组,然后在规则 80--->8080((如果路径 /apples/) ),80--->8180(如果路径 /grapes/)

但这种方法不起作用,流量仅适用于默认路由。

  1. 如果我为每个端口创建侦听器,例如 8080 --?8080(目标组),那么我的负载均衡器 URL 将类似于

LB:端口/路径/

我不想在 URL 中包含端口。

请帮忙

amazon-web-services amazon-elb

5
推荐指数
1
解决办法
4414
查看次数

隐藏 angular 8 中的导航栏(auth-guard 路线未记录在 routes.event 中)

全部,

在实施身份验证保护之前,我能够在登录和注册屏幕中隐藏我的导航栏。通过读取 component.ts 中的路由事件并通过 ngIf 隐藏导航栏。在我实现了 auth guard 后,auth guard 到登录页面的路由没有隐藏下面的导航栏是我的代码..

在这里,我的 auth 守卫服务将检查用户是否通过 auth 服务(将从 cognito 获取数据)进行身份验证。现在,我怎样才能从 auth 守卫发生的路线中隐藏导航栏。请帮忙

应用程序组件.html

<app-toolbar *ngIf="isShowNavbar"   ></app-toolbar>

<router-outlet></router-outlet>
Run Code Online (Sandbox Code Playgroud)

app.component.ts

import { Component,OnInit } from '@angular/core';
import {AuthorizationService} from "./authorization.service";
import { Router, ActivatedRoute, UrlSegment, NavigationEnd } from '@angular/router';
import { Observable } from 'rxjs';
import { first, distinctUntilChanged, throttleTime } from '../../node_modules/rxjs/operators';
@Component({
  // tslint:disable-next-line: component-selector
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent implements OnInit  {

  isLoggedIn$: Observable<boolean>; …
Run Code Online (Sandbox Code Playgroud)

angular-routing angular auth-guard angular-guards angular8

3
推荐指数
1
解决办法
1442
查看次数