【发布时间】:2026-01-26 14:10:01
【问题描述】:
如何配置我的短域以转发到我的主域但保留 url 路径?比如……
example.org/<keep-this> 应该重定向到example.com/<keep-this>
目前,url 路径正在被抛出,所以我看到了这个...example.org/<keep-this> 重定向到 example.com
注意:我的主域在 AWS S3/CloudFont/Route-53 托管和管理。
分发的配置如下:
"ETag": "<hidden>”,
"DistributionConfig": {
"CallerReference": "<hidden>",
"Aliases": {
"Quantity": 2,
"Items": [
"<hidden>",
"www.<hidden>"
]
},
"DefaultRootObject": "index.html",
"Origins": {
"Quantity": 1,
"Items": [
{
"Id": "S3-<hidden>",
"DomainName": "<hidden>.s3.amazonaws.com",
"OriginPath": "",
"CustomHeaders": {
"Quantity": 0
},
"S3OriginConfig": {
"OriginAccessIdentity": ""
},
"ConnectionAttempts": 3,
"ConnectionTimeout": 10
}
]
},
"OriginGroups": {
"Quantity": 0
},
"DefaultCacheBehavior": {
"TargetOriginId": "S3-<hidden>",
"TrustedSigners": {
"Enabled": false,
"Quantity": 0
},
"ViewerProtocolPolicy": "redirect-to-https",
"AllowedMethods": {
"Quantity": 2,
"Items": [
"HEAD",
"GET"
],
"CachedMethods": {
"Quantity": 2,
"Items": [
"HEAD",
"GET"
]
}
},
"SmoothStreaming": false,
"Compress": true,
"LambdaFunctionAssociations": {
"Quantity": 0
},
"FieldLevelEncryptionId": "",
"CachePolicyId": "<hidden>"
},
"CacheBehaviors": {
"Quantity": 0
},
"CustomErrorResponses": {
"Quantity": 1,
"Items": [
{
"ErrorCode": 403,
"ResponsePagePath": "/error.html",
"ResponseCode": "404",
"ErrorCachingMinTTL": 60
}
]
},
"Comment": "",
"Logging": {
"Enabled": false,
"IncludeCookies": false,
"Bucket": "",
"Prefix": ""
},
"PriceClass": "PriceClass_All",
"Enabled": true,
"ViewerCertificate": {
"ACMCertificateArn": "<hidden>",
"SSLSupportMethod": "sni-only",
"MinimumProtocolVersion": "TLSv1.2_2019",
"Certificate": "<hidden>",
"CertificateSource": "acm"
},
"Restrictions": {
"GeoRestriction": {
"RestrictionType": "none",
"Quantity": 0
}
},
"WebACLId": "",
"HttpVersion": "http2",
"IsIPV6Enabled": true
}
}
【问题讨论】:
-
您需要展示您的 CloudFront 配置,包括来源和行为。请使用aws cloudfront get-distribution-config 的输出更新您的问题(或者,如果您使用的是 CloudFormation 或 Terraform,请使用资源定义)。
-
您说的是 URL parameters 还是 paths?你说参数,但你的例子显示了一个路径。
-
感谢您的区别 - 只是将其从“参数”更改为“路径”。
-
谢谢@Parsifal——刚刚添加了每个 get-distribution-config 的输出——我用
隐藏了任何可能独特或敏感的东西,只是为了确保我没有做任何危险的事情! -
标签: amazon-web-services web url amazon-s3 dns