Parse Server部署在Application Load Balancer后面的AWS Elastic Beanstalk上。
EB环境URL为:example.us-east-1.elasticbeanstalk.com
。外部CNAME记录parse.example.com
指向该环境URL。
解析服务器需要配置为:
serverURL
(用于服务器内部调用,例如云代码)publicServerURL
(用于撰写由客户在公共场所调用的URL)对于publicServerURL
,使用https://parse.example.com/parse
似乎是显而易见的,因为公共客户端将调用此端点。
但是serverURL
必须设置为私有 URL,否则服务器会通过Internet网关向自身发送请求,这会产生“数据转移成本” 在AWS中。
当我eb ssh
进入EC2实例时,parse.example.com
和example.us-east-1.elasticbeanstalk.com
都解析为负载均衡器的 public IP。
nslookup parse.example.com
Server: 172.31.0.2
Address: 172.31.0.2#53
Non-authoritative answer:
parse.example.com canonical name = example.us-east-1.elasticbeanstalk.com.
Name: example.us-east-1.elasticbeanstalk.com
Address: 52.72.xxx.xxx
Name: example.us-east-1.elasticbeanstalk.com
Address: 52.45.xxx.xxx
nslookup example.us-east-1.elasticbeanstalk.com
Server: 172.31.0.2
Address: 172.31.0.2#53
Non-authoritative answer:
Name: example.us-east-1.elasticbeanstalk.com
Address: 52.72.xxx.xxx
Name: example.us-east-1.elasticbeanstalk.com
Address: 52.45.xxx.xxx
那么serverURL
必须进行什么设置才能对私有IP进行内部呼叫?