本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
為您的入口網站設定自訂網域
運作方式
當您設定自訂網域時:
-
您可以使用自訂網域建立和設定反向代理,將流量路由到入口網站端點。
-
使用者透過您的自訂網域存取您的入口網站,而不是預設入口網站端點。
-
SSL 憑證可確保整個程序的安全連線。
先決條件
在設定自訂網域之前,請確定您有:
-
您透過 DNS 服務提供者管理的網域名稱,例如 Amazon Route53。
-
WorkSpaces 安全瀏覽器入口網站。如需建立入口網站的詳細資訊,請參閱 為 Amazon WorkSpaces 安全瀏覽器建立 Web 入口網站。
-
確保您擁有管理 AWS Certificate Manager、CloudFront 和 DNS 組態的必要許可。
重要
使用者必須在其瀏覽器中為自訂網域啟用第三方 Cookie,以確保適當的入口網站功能。
確保您擁有並正確管理自訂網域及其 DNS 記錄,以維護入口網站的安全性和功能。
注意
若要啟用自訂網域的單一登入擴充功能,使用者必須在瀏覽器中安裝 擴充功能,版本必須高於 1.0.2505.6608。
當使用者登入入口網站時,系統會提示他們安裝擴充功能。如需有關擴充功能使用者體驗的詳細資訊,請參閱 Amazon WorkSpaces 安全瀏覽器的單一登入延伸模組。
開始使用
您可以在建立新入口網站或編輯現有入口網站時,將自訂網域設定為入口網站設定屬性。這可以使用 AWS 主控台、 SDK、CloudFormation 或 AWS CLI 命令來完成。
我們建議將 Amazon CloudFront 分佈設定為反向代理,將流量從您的自訂網域路由到 WorkSpaces 安全瀏覽器入口網站端點。
注意
雖然建議使用 Amazon CloudFront 做為反向代理解決方案,但您可以使用替代的反向代理組態。請確定您符合 Amazon CloudFront 設定步驟中詳述的必要原始伺服器和快取組態設定。
將 CloudFront 設定為反向代理
若要完成設定反向代理,您需要:
-
透過 AWS Certificate Manager (ACM) 的 SSL 憑證
-
Amazon CloudFront 分佈
-
DNS 記錄
-
使用自訂網域設定的入口網站
SSL 憑證
如果您還沒有,請依照下列步驟透過 ACM 請求一個:
-
導覽至位於 的 ACM 主控台https://console.aws.amazon.com/acm
。 重要
使用美國東部 (維吉尼亞北部) 區域,因為 CloudFront 需要將憑證存放在該區域。
-
請求憑證:
-
對於新的 ACM 使用者:選擇佈建憑證下的入門
-
對於現有的 ACM 使用者:選擇請求憑證
-
-
選擇請求公有憑證,然後選擇請求憑證。
注意
您也可以匯入現有的憑證。如需詳細資訊,請參閱《ACM 使用者指南》中的將憑證匯入 ACM。
-
輸入您的主要網域名稱 (例如
myportal.example.com)。 -
選擇驗證方法:
-
檢閱您的設定,然後選擇確認和請求。
CloudFront 分佈
建立 CloudFront 分佈,將請求從自訂網域代理到入口網站端點。
-
導覽至位於 的 CloudFront 主控台https://console.aws.amazon.com/cloudfront
。 -
選擇 Create Distribution (建立分佈)。
-
分佈名稱:輸入分佈的名稱
-
分佈類型:單一網站或應用程式
注意
如果您的自訂網域是在相同 AWS 帳戶中的 Route 53 中管理,CloudFront 可以自動為您管理您的 DNS。輸入您的自訂網域,然後按一下「檢查網域」。如果您有來自不同 DNS 供應商的網域,請略過此步驟,稍後再設定您的網域。
-
-
設定原始伺服器設定:
-
原始伺服器類型:其他
-
自訂原始伺服器:輸入入口網站端點
<portalId>.workspaces-web.com -
原始路徑:保留空白 (預設)
-
-
自訂原始伺服器設定:
-
新增自訂標頭
重要
只有在代理請求中存在此標頭時,才能透過自訂網域存取入口網站。確定標頭名稱和值的指定與上述完全相同。
-
標頭名稱:workspacessecurebrowser-custom-domain
-
值:您的自訂網域 (例如
myportal.example.com)
-
-
通訊協定:僅限 HTTPS
-
HTTPS 連接埠:443 (保留預設值)
-
最低原始 SSL 通訊協定:TLSv1.2 (預設)
-
原始 IP 地址類型:僅限 IPv4 (撰寫此管理指南時,Amazon WorkSpaces 安全瀏覽器不支援 IPv6。)
-
-
自訂快取設定:
-
檢視器通訊協定政策:將 HTTP 重新導向至 HTTPS
-
允許 HTTP 方法:GET、HEAD、OPONS、PUT、POST、PATCH、DELETE
-
快取政策:CachingDisabled
-
原始伺服器請求政策:AllViewerExceptHostHeader
重要
只有在原始伺服器請求政策設定為 AllViewerExceptHostHeader 時,才能透過自訂網域存取入口網站。顧名思義,此政策只會從請求標頭篩選出主機標頭,並將所有剩餘的標頭傳遞至原始伺服器。
-
-
您可以視需要設定 WAF,但此設定不需要。
-
在取得 TLS 憑證中,選取在步驟 1 中建立的 TLS 憑證。
-
檢閱設定,然後選擇建立分佈。
DNS 記錄
如果您的託管區域位於相同的 AWS 帳戶中,Cloudfront 可以更新 Route 53 中的 DNS 記錄,將流量從指定的網域路由到步驟 2 中建立的分佈。
-
導覽至 CloudFront 設定
-
按一下「將網域路由到 CloudFront」
-
按一下「自動設定路由」
如果您已為另一個服務提供者或其他 AWS 帳戶中的自訂網域設定 DNS,請設定您的 DNS 提供者,將網域的流量路由至 分佈。下列步驟說明如何使用 Route 53 執行此操作。
-
在 開啟 Amazon Route 53 主控台https://console.aws.amazon.com/route53
。 -
存取 DNS 管理:
-
如果您不熟悉搭配此 AWS 帳戶使用 Route 53,則會開啟 Amazon Route 53 概觀頁面。在 DNS 管理下,選擇立即開始使用。
-
如果您之前已使用此 AWS 帳戶使用 Route 53,請繼續下一個步驟。
-
-
在導覽窗格中,選擇 Hosted zones (託管區域)。
-
如果您還沒有託管區域,請建立託管區域:
-
在託管區域頁面上,選擇您要管理的託管區域名稱。
-
選擇 Create Record Set (建立記錄集)。
-
為您的網域建立項目 (例如
myportal.example.com):-
類型:A – IPv4 地址
-
Alias (別名):是
-
別名目標:CloudFront 分佈 URL
保留所有其他設定的預設值。
-
注意
如果您不是使用 Route 53 來管理網域的 DNS,請使用 DNS 服務提供者,並將指向網域的 DNS 項目新增至 CloudFront 分佈的 URL。
或者,您可以使用下列 CloudFormation 範本來建立 CloudFront 分佈:
此 CloudFormation 範本會自動建立 CloudFront 分佈、設定反向代理設定,以及選擇性地建立 Route53 DNS 記錄:
範例 workspaces-web-custom-domain-template.yaml
AWSTemplateFormatVersion: '2010-09-09' Description: 'CloudFront Distribution for custom domain configuration with existing AWS WorkSpaces Secure Browser Portal' Parameters: PortalEndpoint: Type: String Description: 'The endpoint of your existing WorkSpaces Web Portal (e.g., abc123.workspaces-web.com)' AllowedPattern: '^[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)?\.workspaces-web\.com$' ConstraintDescription: 'Must be a valid WorkSpaces Web portal endpoint' CustomDomainName: Type: String Description: 'Custom domain name for the portal (e.g., myportal.example.com)' AllowedPattern: '^([a-zA-Z0-9]?((?!-)([A-Za-z0-9-]*[A-Za-z0-9])\.)+[a-zA-Z0-9]+)$' ConstraintDescription: 'Must be a valid domain name' CertificateArn: Type: String Description: 'ARN of the validated SSL certificate in ACM (must be in us-east-1 region for CloudFront)' AllowedPattern: 'arn:aws:acm:us-east-1:[0-9]{12}:certificate/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}' ConstraintDescription: 'Must be a valid ACM certificate ARN in us-east-1 region' CreateRoute53Record: Type: String Description: 'Create Route53 record for custom domain (requires existing hosted zone)' Default: 'No' AllowedValues: - 'Yes' - 'No' HostedZoneId: Type: String Description: 'Route53 Hosted Zone ID for the custom domain (required if creating Route53 record)' Default: '' Conditions: ShouldCreateRoute53Record: !And - !Equals [!Ref CreateRoute53Record, 'Yes'] - !Not [!Equals [!Ref HostedZoneId, '']] Resources: # CloudFront Distribution CloudFrontDistribution: Type: AWS::CloudFront::Distribution Properties: DistributionConfig: Aliases: - !Ref CustomDomainName Comment: !Sub 'CloudFront distribution for WorkSpaces Web Portal - ${CustomDomainName}' Enabled: true HttpVersion: http2 IPV6Enabled: false # WorkSpaces Secure Browser does not support IPv6 PriceClass: PriceClass_All # Origin Configuration Origins: - Id: WorkSpacesWebOrigin DomainName: !Ref PortalEndpoint CustomOriginConfig: HTTPSPort: 443 OriginProtocolPolicy: https-only OriginSSLProtocols: - TLSv1.2 OriginCustomHeaders: - HeaderName: workspacessecurebrowser-custom-domain HeaderValue: !Ref CustomDomainName # Default Cache Behavior DefaultCacheBehavior: TargetOriginId: WorkSpacesWebOrigin ViewerProtocolPolicy: https-only AllowedMethods: - GET - HEAD - OPTIONS - PUT - POST - PATCH - DELETE Compress: false # Cache Policy: CachingDisabled (using predefined managed policy) CachePolicyId: 4135ea2d-6df8-44a3-9df3-4b5a84be39ad # Origin Request Policy: AllViewerExceptHostHeader (using predefined managed policy) OriginRequestPolicyId: b689b0a8-53d0-40ab-baf2-68738e2966ac # SSL Configuration ViewerCertificate: AcmCertificateArn: !Ref CertificateArn SslSupportMethod: sni-only MinimumProtocolVersion: TLSv1.2_2021 Tags: - Key: Name Value: !Sub '${AWS::StackName}-cloudfront' # Route 53 Record (optional - requires hosted zone to exist) Route53Record: Type: AWS::Route53::RecordSet Condition: ShouldCreateRoute53Record Properties: HostedZoneId: !Ref HostedZoneId Name: !Ref CustomDomainName Type: A AliasTarget: DNSName: !GetAtt CloudFrontDistribution.DomainName HostedZoneId: Z2FDTNDATAQYW2 # CloudFront Hosted Zone ID EvaluateTargetHealth: false Outputs: PortalEndpoint: Description: 'WorkSpaces Web Portal endpoint used as origin' Value: !Ref PortalEndpoint Export: Name: !Sub '${AWS::StackName}-PortalEndpoint' CustomDomainEndpoint: Description: 'Custom domain endpoint for the portal' Value: !Sub 'https://${CustomDomainName}' Export: Name: !Sub '${AWS::StackName}-CustomDomainEndpoint' CloudFrontDistributionId: Description: 'CloudFront Distribution ID' Value: !Ref CloudFrontDistribution Export: Name: !Sub '${AWS::StackName}-CloudFrontDistributionId' CloudFrontDomainName: Description: 'CloudFront Distribution Domain Name' Value: !GetAtt CloudFrontDistribution.DomainName Export: Name: !Sub '${AWS::StackName}-CloudFrontDomainName' CertificateArn: Description: 'SSL Certificate ARN used by CloudFront' Value: !Ref CertificateArn Export: Name: !Sub '${AWS::StackName}-CertificateArn' Metadata: AWS::CloudFormation::Interface: ParameterGroups: - Label: default: "Existing Portal Configuration" Parameters: - PortalEndpoint - Label: default: "Custom Domain Configuration" Parameters: - CustomDomainName - CertificateArn - CreateRoute53Record - HostedZoneId ParameterLabels: PortalEndpoint: default: "Portal Endpoint" CustomDomainName: default: "Custom Domain Name" CertificateArn: default: "SSL Certificate ARN" CreateRoute53Record: default: "Create Route53 Record" HostedZoneId: default: "Hosted Zone ID"
若要使用此範本:
-
將上述範本儲存為
workspaces-web-custom-domain-template.yaml -
使用 AWS 主控台、 AWS CLI 或 AWS SDK 搭配特定參數值進行部署
-
部署之後,請使用自訂網域設定您的入口網站,如以下步驟 4 所述
入口網站組態
使用 AWS 主控台、UpdatePortal API 或 update-portal CLI AWS 命令,將您的自訂網域註冊為入口網站設定屬性。
-
在 開啟 WorkSpaces 安全瀏覽器主控台https://console.aws.amazon.com/workspaces-web/home
。 -
在導覽窗格中,選擇 Web 入口網站。
-
選取您要設定的 Web 入口網站,然後選擇編輯。
-
在入口網站設定中,新增您的自訂網域。
-
儲存入口網站組態。
測試您的組態
若要測試您的組態,請依照下列步驟進行:
-
開啟 Web 瀏覽器並導覽至自訂網域的 URL (例如
https://myportal.example.com)。 -
如果一切設定正確,您應該會看到入口網站的登入頁面。
-
接著,在瀏覽器中輸入入口網站 URL,您應該會在登入 IdP 之後重新導向至自訂網域。
-
最後,登入您的 IdP,然後按一下入口網站的應用程式圖磚。您應該重新導向至自訂網域。