[英]PFFile returns incorrect Image URL
這是我的NGINX設置,
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"
}
}
]
}
我的快捷代碼設置
let configuration = ParseClientConfiguration {
$0.applicationId = "MyAppID"
$0.clientKey = "Blank"
$0.server = "https://www.myserver.com/myparseserver/"
}
看來
PFFile URL返回NON-SSL URL和不正確的PFFile存儲路徑!
可以從瀏覽器手動訪問圖像文件,從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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.