亚马逊最近在CloudFront上推出了一项新功能,该功能使用SNI(服务器名称指示)免费支持自定义SSL证书.
我使用StartSSL的免费Class 1证书设置了我的发行版,当我注意到该站点在部署后的短时间内发生故障时,一切正常.运行SSL Checker会返回我的证书正常工作:
但是当我尝试通过HTTPS访问网站时,我会点击此错误页面(它将适用于第一个请求,然后在后续尝试连接时关闭).
使用ssl访问时,这是一个详细的输出(在索引上成功):
$ curl -I -v -ssl https://wikichen.is
* Adding handle: conn: 0x7f9f82804000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f9f82804000) send_pipe: 1, recv_pipe: 0
* About to connect() to wikichen.is port 443 (#0)
* Trying 54.230.141.222...
* Connected to wikichen.is (54.230.141.222) port 443 (#0)
* TLS 1.2 connection using TLS_RSA_WITH_RC4_128_MD5
* Server certificate: www.wikichen.is (6w984WNu7vM5OrdU)
* Server certificate: StartCom Class 1 Primary …
Run Code Online (Sandbox Code Playgroud) 我有一个静态网站,向API服务器发出请求。我使用S3托管此静态页面,我想使用CloudFront将api调用重定向到api服务器。api调用可以通过api的路径前缀来区分:
domain.com/index.html s3/index.html
domain.com/js/index.js s3/js/index.html
domain.com/api/request api_server/api/request
domain.com/api/other/request api_server/api/other/request
Run Code Online (Sandbox Code Playgroud)
我目前设置了两个来源-一个用于S3存储桶的S3来源(正在运行),另一个用于我的api服务器的自定义来源(无法运行)。
自定义来源设置如下:
Origin Domain Name: api_elb
Origin path: /
Run Code Online (Sandbox Code Playgroud)
行为设置如下:
Precedence: 0
Path pattern: /api/*
Allowed HTTP Methods: GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE
Forward Headers: all
Forward Query Strings: yes
Run Code Online (Sandbox Code Playgroud)
这是完整的答复:
> GET /api/logout HTTP/1.1
> Host: a0000aaaaaaaaa.cloudfront.net
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 502 Bad Gateway
< Content-Type: text/html
< Content-Length: 587
< Connection: keep-alive
< Server: CloudFront
< Date: Mon, 06 Jun 2016 19:37:45 …
Run Code Online (Sandbox Code Playgroud) 我已经在API网关后面建立了一个Lambda函数,它可以很好地工作.我有一个托管网站,我只想要某个位置来访问API.
https://www.example.com/(从托管服务器提供html)
https://www.example.com/foobar(返回由Lambda生成并由AWS返回的JSON有效内容)
这是我的服务器块:
location = /foobar {
proxy_pass https://someawsuri;
proxy_redirect default;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
Run Code Online (Sandbox Code Playgroud)
我已经尝试过审阅文档并阅读多篇SO帖子,但我无法做到我想要的.我尝试过的所有东西都产生了错误502 Bad Gateway
.
如何配置nginx向API网关发出请求?
谢谢.