apr*_*eda 5 geolocation amazon-web-services aws-api-gateway aws-sam-cli aws-sam
我正在使用 AWS SAM CLI
根据https://aws.amazon.com/about-aws/whats-new/2020/07/cloudfront-geolocation-headers/已经支持地理定位,并且 CloudFront 返回地理定位标头;例子:
CloudFront-Viewer-Country-Name: United States
CloudFront-Viewer-Country-Region: MI
CloudFront-Viewer-Country-Region-Name: Michigan
CloudFront-Viewer-City: Ann Arbor
CloudFront-Viewer-Postal-Code: 48105
CloudFront-Viewer-Time-Zone: America/Detroit
CloudFront-Viewer-Latitude: 42.30680
CloudFront-Viewer-Longitude: -83.70590
CloudFront-Viewer-Metro-Code: 505
Run Code Online (Sandbox Code Playgroud)
我希望能够使用我的 API 网关 REST API 访问这些内容,这是我的 aws sam 模板的示例。
Resources:
login:
Type: AWS::Serverless::Function
Properties:
Handler: src/functions/login.handler
Runtime: nodejs14.x
Layers:
- !Ref dependencies
Events:
ApiEvent:
Type: Api
Properties:
Method: post
Path: /login
RestApiId:
Ref: mainBackendApi
mainBackendApi:
Type: AWS::Serverless::Api
Properties:
StageName: !Ref Stage
EndpointConfiguration:
Type: EDGE
Domain:
DomainName: !Sub
- <hidden>
- apiSubDomain: !FindInMap
- stageVars
- !Ref Stage
- apiSubDomain
CertificateArn: !Ref customDomainCert
Route53:
HostedZoneId: <hidden>
Run Code Online (Sandbox Code Playgroud)
到目前为止,我已经研究了5个小时,还没有找到任何实际的解决方案,所以我别无选择,只能在这里提问。希望有人可以帮助我。
我在这里也问了这个问题https://github.com/aws/aws-sam-cli/issues/2498但我被拒绝了。
| 归档时间: |
|
| 查看次数: |
638 次 |
| 最近记录: |