【发布时间】:2018-03-03 06:40:00
【问题描述】:
我遇到了这个问题,我有一个聊天服务器需要与托管在 aws 中的 lambda 服务进行通信,但是云前端会引发以下错误。
BODY: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
Bad request.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: h5kPdVnMXwh-P7e7mxQ5LL1gj9fAupp_MNAPxmxufI74W4WhE_MByw==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>
这就是我的请求进入应用程序的方式。
const options = {
hostname: 'xxx.uat.com',
port : '443',
path: '/qa/addMessage',
method: 'POST'
};
const req = http.request(options, (res) => {
}
聊天 server.js 托管在 ec2 中。这里有什么问题?
【问题讨论】:
-
http是什么对象? -
const http = require('http');
标签: amazon-web-services amazon-ec2 amazon-cloudfront serverless-framework