将 Elastic Beanstalk 协议更改为 TCP/SSL,现在 S3 连接不再有效
Changed Elastic Beanstalk protocols to TCP/SSL and now S3 connection no longer works
我最近不得不更改我的开发服务器上的协议以启用 ParseLiveQuery
,我注意到来自应用程序的请求不再接收图像并尝试保存,也失败了。
请求我得到
[Error]: Response status code was unacceptable: 403 (Code: 1, Version: 1.17.1)
尝试保存我得到的图像:
[Error]: Could not store file. (Code: 130, Version: 1.17.1)
2018-08-16 14:22:54.361221-0400 myApp[83331:20699254] getting latest for sale
Optional(Error Domain=Parse Code=130 "Could not store file." UserInfo={code=130, temporary=0, error=Could not store file., NSLocalizedDescription=Could not store file.})
这是我的端口协议设置:
我正在尝试的代码 运行 post
let obj = PFObject(className: "GroupConvos")
obj.setObject("The Picnic", forKey: "groupName")
obj.setObject("zackshapiro created 'The Picnic'", forKey: "lastMessageText")
obj.setObject("system", forKey: "lastMessageSender")
let img = UIImage(named: "picnic")!
let data = UIImageJPEGRepresentation(img, 0.8)!
let file = PFFile(name: "avatar", data: data)!
// let file = try! PFFile(name: "avatar123456", data: data, contentType: "image/jpeg")
file.saveInBackground { (completed, error) in
print(error)
if completed {
obj.setObject(file, forKey: "groupImage")
obj.saveInBackground(block: { (completed, error) in
if completed {
print("done")
}
})
}
}
我的 index.js 中的 s3 适配器代码没有改变
var S3Adapter = require('parse-server').S3Adapter;
var s3Adapter = new S3Adapter(
"my bucket",
{ directAccess: true,
baseUrl: 'http://someURL1234.cloudfront.net'
}
);
然后我将其插入到我的 ParseServer
对象中。
知道这里发生了什么吗?该问题不存在于协议仍为 HTTP (80) 和 HTTPS (443) 的生产环境中
谢谢
您的问题是由于 HTTPS (SSL) 流量和 HTTP 流量使用相同的端口 80 引起的。您需要在后端设置 HTTPS 和 SSL 证书。
当您在负载均衡器中启用 TCP 侦听器(第 4 层侦听器)时,LB 只是将连接直接传递到您的后端。这也意味着 SSL 证书将不会在 LB(对于 TCP 侦听器)上使用,而是必须在后端服务器上设置。
我最近不得不更改我的开发服务器上的协议以启用 ParseLiveQuery
,我注意到来自应用程序的请求不再接收图像并尝试保存,也失败了。
请求我得到
[Error]: Response status code was unacceptable: 403 (Code: 1, Version: 1.17.1)
尝试保存我得到的图像:
[Error]: Could not store file. (Code: 130, Version: 1.17.1) 2018-08-16 14:22:54.361221-0400 myApp[83331:20699254] getting latest for sale Optional(Error Domain=Parse Code=130 "Could not store file." UserInfo={code=130, temporary=0, error=Could not store file., NSLocalizedDescription=Could not store file.})
这是我的端口协议设置:
我正在尝试的代码 运行 post
let obj = PFObject(className: "GroupConvos")
obj.setObject("The Picnic", forKey: "groupName")
obj.setObject("zackshapiro created 'The Picnic'", forKey: "lastMessageText")
obj.setObject("system", forKey: "lastMessageSender")
let img = UIImage(named: "picnic")!
let data = UIImageJPEGRepresentation(img, 0.8)!
let file = PFFile(name: "avatar", data: data)!
// let file = try! PFFile(name: "avatar123456", data: data, contentType: "image/jpeg")
file.saveInBackground { (completed, error) in
print(error)
if completed {
obj.setObject(file, forKey: "groupImage")
obj.saveInBackground(block: { (completed, error) in
if completed {
print("done")
}
})
}
}
我的 index.js 中的 s3 适配器代码没有改变
var S3Adapter = require('parse-server').S3Adapter;
var s3Adapter = new S3Adapter(
"my bucket",
{ directAccess: true,
baseUrl: 'http://someURL1234.cloudfront.net'
}
);
然后我将其插入到我的 ParseServer
对象中。
知道这里发生了什么吗?该问题不存在于协议仍为 HTTP (80) 和 HTTPS (443) 的生产环境中
谢谢
您的问题是由于 HTTPS (SSL) 流量和 HTTP 流量使用相同的端口 80 引起的。您需要在后端设置 HTTPS 和 SSL 证书。
当您在负载均衡器中启用 TCP 侦听器(第 4 层侦听器)时,LB 只是将连接直接传递到您的后端。这也意味着 SSL 证书将不会在 LB(对于 TCP 侦听器)上使用,而是必须在后端服务器上设置。