PFFile returns 不正确的图像 URL
PFFile returns incorrect Image URL
这是我的 NGINX 设置,
HTTPS 服务器
server {
listen 443 ssl spdy;
location /myparseserver/ {
error_page 404 = /404.html;
error_page 500 502
503 504 = /404.html;
proxy_pass http://127.0.0.1:1401/parse/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
解析服务器设置
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/parse-myparseserver',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'MyAppID',
masterKey: process.env.MASTER_KEY || '123456', //Add your master key here. Keep it secret!
serverURL: process.env.SERVER_URL || 'https://localhost:1401/myparseserver', // Don't forget to change to https if needed
verbose: true
这是我的 NGINX 详细结果,
verbose: RESPONSE from [GET] /parse/classes/Stories: {
"response": {
"results": [
{
"objectId": "F17Qm4Gr2f",
"title": "This is title",
"createdAt": "2017-06-29T00:58:40.214Z",
"updatedAt": "2017-06-29T00:59:10.206Z",
"publish": "1",
"description": "This is description",
"category": "1",
"image": {
"__type": "File",
"name": "498f1ea4f3b722bb5a56accdb592bf3f_f19a80f4b870267022a087dd6d8cac37.jpg",
"url": "http://www.myserver.com/parse/files/MyAppID/498f1ea4f3b722bb5a56accdb592bf3f_f19a80f4b870267022a087dd6d8cac37.jpg"
}
}
]
}
我的swift代码设置,
let configuration = ParseClientConfiguration {
[=15=].applicationId = "MyAppID"
[=15=].clientKey = "Blank"
[=15=].server = "https://www.myserver.com/myparseserver/"
}
看来
PFFile URL returns NON-SSL URL and Incorrect PFFile storage path!
图像文件可以从浏览器手动访问,稍微从 parse 更改为 myparseserver ,
http://www.myserver.com/myparseserver/files/MyAppID/498f1ea4f3b722bb5a56accdb592bf3f_f19a80f4b870267022a087dd6d8cac37.jpg
如有任何建议,我们将不胜感激
谢谢
如文档中所述,您是否设置了 publicServerUrl?
在 Parse 上使用文件时,您需要在 Parse Server 配置中使用 publicServerURL 选项。这是将从中访问文件的 URL,因此它应该是解析为您的 Parse Server 的 URL。确保在此 URL.
中包含您的挂载点
http://docs.parseplatform.org/parse-server/guide/#configuring-file-adapters
这是我的 NGINX 设置,
HTTPS 服务器
server {
listen 443 ssl spdy;
location /myparseserver/ {
error_page 404 = /404.html;
error_page 500 502
503 504 = /404.html;
proxy_pass http://127.0.0.1:1401/parse/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
解析服务器设置
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/parse-myparseserver',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'MyAppID',
masterKey: process.env.MASTER_KEY || '123456', //Add your master key here. Keep it secret!
serverURL: process.env.SERVER_URL || 'https://localhost:1401/myparseserver', // Don't forget to change to https if needed
verbose: true
这是我的 NGINX 详细结果,
verbose: RESPONSE from [GET] /parse/classes/Stories: {
"response": {
"results": [
{
"objectId": "F17Qm4Gr2f",
"title": "This is title",
"createdAt": "2017-06-29T00:58:40.214Z",
"updatedAt": "2017-06-29T00:59:10.206Z",
"publish": "1",
"description": "This is description",
"category": "1",
"image": {
"__type": "File",
"name": "498f1ea4f3b722bb5a56accdb592bf3f_f19a80f4b870267022a087dd6d8cac37.jpg",
"url": "http://www.myserver.com/parse/files/MyAppID/498f1ea4f3b722bb5a56accdb592bf3f_f19a80f4b870267022a087dd6d8cac37.jpg"
}
}
]
}
我的swift代码设置,
let configuration = ParseClientConfiguration {
[=15=].applicationId = "MyAppID"
[=15=].clientKey = "Blank"
[=15=].server = "https://www.myserver.com/myparseserver/"
}
看来
PFFile URL returns NON-SSL URL and Incorrect PFFile storage path!
图像文件可以从浏览器手动访问,稍微从 parse 更改为 myparseserver ,
http://www.myserver.com/myparseserver/files/MyAppID/498f1ea4f3b722bb5a56accdb592bf3f_f19a80f4b870267022a087dd6d8cac37.jpg
如有任何建议,我们将不胜感激
谢谢
如文档中所述,您是否设置了 publicServerUrl?
在 Parse 上使用文件时,您需要在 Parse Server 配置中使用 publicServerURL 选项。这是将从中访问文件的 URL,因此它应该是解析为您的 Parse Server 的 URL。确保在此 URL.
中包含您的挂载点http://docs.parseplatform.org/parse-server/guide/#configuring-file-adapters