通过 Https 访问 Parse 仪表板
Access Parse Dashboard Over Https
我在 linux vps 上有解析服务器 运行 没有任何问题。现在我正在尝试添加解析仪表板以与同一台服务器上的辅助解析服务器一起工作。我克隆了解析服务器示例存储库作为开始 point.the 我现在面临的问题是我无法访问仪表板(事实上我可以但是问题发生在我登录加载动画开始但过了一会儿什么都没有发生了,屏幕是空白的。我已经在我的机器上本地测试了 express 应用程序,我能够访问仪表板并进行解析,一切都是 fine.if 我查看了浏览器控制台我有这个错误
localhost:1337/parse/serverInfo:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
dashboard.bundle.js:45 TypeError: Cannot read property 'schemas' of undefined
at t.value (dashboard.bundle.js:95)
at ba (dashboard.bundle.js:45)
at ya (dashboard.bundle.js:45)
at Zs (dashboard.bundle.js:45)
at Ws (dashboard.bundle.js:45)
at zs (dashboard.bundle.js:45)
at Ps (dashboard.bundle.js:45)
at dashboard.bundle.js:45
at t.unstable_runWithPriority (dashboard.bundle.js:53)
at fi (dashboard.bundle.js:45)
Pa @ dashboard.bundle.js:45
localhost:1337/parse/serverInfo:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
localhost:1337/parse/schemas:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
VM27:1 POST http://localhost:1337/parse/schemas net::ERR_CONNECTION_REFUSED
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
VM27:1 POST http://localhost:1337/parse/schemas net::ERR_CONNECTION_REFUSED
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
setTimeout (async)
(anonymous) @ dashboard.bundle.js:16
c.onreadystatechange @ dashboard.bundle.js:80
XMLHttpRequest.send (async)
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
VM27:1 POST http://localhost:1337/parse/schemas net::ERR_CONNECTION_REFUSED
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
setTimeout (async)
(anonymous) @ dashboard.bundle.js:16
c.onreadystatechange @ dashboard.bundle.js:80
XMLHttpRequest.send (async)
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
setTimeout (async)
(anonymous) @ dashboard.bundle.js:16
c.onreadystatechange @ dashboard.bundle.js:80
XMLHttpRequest.send (async)
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
VM27:1 POST http://localhost:1337/parse/schemas net::ERR_CONNECTION_REFUSED
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
setTimeout (async)
(anonymous) @ dashboard.bundle.js:16
c.onreadystatechange @ dashboard.bundle.js:80
XMLHttpRequest.send (async)
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
setTimeout (async)
(anonymous) @ dashboard.bundle.js:16
c.onreadystatechange @ dashboard.bundle.js:80
XMLHttpRequest.send (async)
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
setTimeout (async)
(anonymous) @ dashboard.bundle.js:16
c.onreadystatechange @ dashboard.bundle.js:80
XMLHttpRequest.send (async)
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
dashboard.bundle.js:80 Uncaught (in promise) Error: XMLHttpRequest failed: "Unable to connect to the Parse API"
at dashboard.bundle.js:80
我在线调查了这个问题并尝试了建议的解决方案(将 allowInsecureHttp 添加到仪表板设置)但没有任何希望
我的设置:
- vps 与 Ubuntu 服务器 运行
nginx 已安装,我还安装了 ssl 证书。将所有请求重定向到 nodejs express 应用程序的 nginx 规则如下
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
proxy_pass http://localhost:1337/;
}
我在同一端口上有解析服务器和解析仪表板 运行,这是 index.js 代码
//Parse Api Setup
var api = new ParseServer({
databaseURI: process.env.DATABASE_URI,
cloud: __dirname + process.env.CLOUD_CODE_MAIN,
appId: process.env.APP_ID,
masterKey: process.env.MASTER_KEY,
serverURL: process.env.SERVER_URL,
mountPath: process.env.PARSE_MOUNT,
publicServerURL: process.env.SERVER_URL,
graphQLServerURL: process.env.GRAPHQL_URL,
graphQLPath: process.env.GRAPHQL_PATH,
verifyUserEmails: false,
verbose: process.env.VERBOSE,
push: {
android: {
apiKey: process.env.FIREBASE_SERVER_KEY
}
// TODO add ios push when start developing ios app
}
// liveQuery: {
// classNames: ['Test', 'TestAgain']
// }
});
// Parse Dashboard Setup
var dashboard = new ParseDashboard({
apps: [
{
appId: process.env.APP_ID,
masterKey: process.env.MASTER_KEY,
serverURL: process.env.SERVER_URL,
appName: process.env.APP_NAME,
graphQLServerURL: process.env.GRAPHQL_URL,
graphQLPath: process.env.GRAPHQL_PATH,
supportedPushLocales: ["en", "ar"],
production: process.env.PRODUCTION
},
],
users: [{
user: "bahaa",
pass: "y$RvjUJx0SLM66/SqzT.oyJ.49AsrUHIsgj0AEEFdn5HLRvUw6L0UeG"
}],
trustProxy: process.env.TRUST_PROXY,
// Use https://www.bcrypt-generator.com.
useEncryptedPasswords: true
}, { allowInsecureHTTP: process.env.DASHBOARD_ALLOW_INSECURE_HTTP });
// GraphQl Api Setup
var parseGraphQLServer = new ParseGraphQLServer(api, {
graphQLPath: '/graphql', playgroundPath: '/playground'
})
var parseApp = express();
// Serve static assets from the /public folder
parseApp.use(express.static(path.join(__dirname, '/public')));
// Serve the Parse API on the /parse URL prefix
parseApp.use(process.env.PARSE_MOUNT, api.app);
// Serve the Dasboard on the /dashboard URL prefix
parseApp.use(process.env.DASHBOARD_MOUNT, dashboard);
// Mounts the GraphQL API
parseGraphQLServer.applyGraphQL(parseApp);
parseApp.get('/', function (req, res) {
res.sendFile(path.join(__dirname, '/public/index.html'));
});
var httpServerParseApi = require('http').createServer(parseApp);
httpServerParseApi.listen(process.env.PARSE_PORT, function () {
console.log('api + dashboard + graphql running on port ' + process.env.PARSE_PORT + '.');
});
问题已解决
我的 ServerUrl 值为:http://localhost:1337/parse
所以我将其更改为 https://mydomian.com/parse 并且没有任何问题
我在 linux vps 上有解析服务器 运行 没有任何问题。现在我正在尝试添加解析仪表板以与同一台服务器上的辅助解析服务器一起工作。我克隆了解析服务器示例存储库作为开始 point.the 我现在面临的问题是我无法访问仪表板(事实上我可以但是问题发生在我登录加载动画开始但过了一会儿什么都没有发生了,屏幕是空白的。我已经在我的机器上本地测试了 express 应用程序,我能够访问仪表板并进行解析,一切都是 fine.if 我查看了浏览器控制台我有这个错误
localhost:1337/parse/serverInfo:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
dashboard.bundle.js:45 TypeError: Cannot read property 'schemas' of undefined
at t.value (dashboard.bundle.js:95)
at ba (dashboard.bundle.js:45)
at ya (dashboard.bundle.js:45)
at Zs (dashboard.bundle.js:45)
at Ws (dashboard.bundle.js:45)
at zs (dashboard.bundle.js:45)
at Ps (dashboard.bundle.js:45)
at dashboard.bundle.js:45
at t.unstable_runWithPriority (dashboard.bundle.js:53)
at fi (dashboard.bundle.js:45)
Pa @ dashboard.bundle.js:45
localhost:1337/parse/serverInfo:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
localhost:1337/parse/schemas:1 Failed to load resource: net::ERR_CONNECTION_REFUSED
VM27:1 POST http://localhost:1337/parse/schemas net::ERR_CONNECTION_REFUSED
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
VM27:1 POST http://localhost:1337/parse/schemas net::ERR_CONNECTION_REFUSED
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
setTimeout (async)
(anonymous) @ dashboard.bundle.js:16
c.onreadystatechange @ dashboard.bundle.js:80
XMLHttpRequest.send (async)
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
VM27:1 POST http://localhost:1337/parse/schemas net::ERR_CONNECTION_REFUSED
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
setTimeout (async)
(anonymous) @ dashboard.bundle.js:16
c.onreadystatechange @ dashboard.bundle.js:80
XMLHttpRequest.send (async)
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
setTimeout (async)
(anonymous) @ dashboard.bundle.js:16
c.onreadystatechange @ dashboard.bundle.js:80
XMLHttpRequest.send (async)
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
VM27:1 POST http://localhost:1337/parse/schemas net::ERR_CONNECTION_REFUSED
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
setTimeout (async)
(anonymous) @ dashboard.bundle.js:16
c.onreadystatechange @ dashboard.bundle.js:80
XMLHttpRequest.send (async)
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
setTimeout (async)
(anonymous) @ dashboard.bundle.js:16
c.onreadystatechange @ dashboard.bundle.js:80
XMLHttpRequest.send (async)
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
setTimeout (async)
(anonymous) @ dashboard.bundle.js:16
c.onreadystatechange @ dashboard.bundle.js:80
XMLHttpRequest.send (async)
(anonymous) @ VM27:1
a @ dashboard.bundle.js:80
dashboard.bundle.js:80 Uncaught (in promise) Error: XMLHttpRequest failed: "Unable to connect to the Parse API"
at dashboard.bundle.js:80
我在线调查了这个问题并尝试了建议的解决方案(将 allowInsecureHttp 添加到仪表板设置)但没有任何希望 我的设置:
- vps 与 Ubuntu 服务器 运行
nginx 已安装,我还安装了 ssl 证书。将所有请求重定向到 nodejs express 应用程序的 nginx 规则如下
proxy_set_header HOST $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location / { proxy_pass http://localhost:1337/; }
我在同一端口上有解析服务器和解析仪表板 运行,这是 index.js 代码
//Parse Api Setup
var api = new ParseServer({
databaseURI: process.env.DATABASE_URI,
cloud: __dirname + process.env.CLOUD_CODE_MAIN,
appId: process.env.APP_ID,
masterKey: process.env.MASTER_KEY,
serverURL: process.env.SERVER_URL,
mountPath: process.env.PARSE_MOUNT,
publicServerURL: process.env.SERVER_URL,
graphQLServerURL: process.env.GRAPHQL_URL,
graphQLPath: process.env.GRAPHQL_PATH,
verifyUserEmails: false,
verbose: process.env.VERBOSE,
push: {
android: {
apiKey: process.env.FIREBASE_SERVER_KEY
}
// TODO add ios push when start developing ios app
}
// liveQuery: {
// classNames: ['Test', 'TestAgain']
// }
});
// Parse Dashboard Setup
var dashboard = new ParseDashboard({
apps: [
{
appId: process.env.APP_ID,
masterKey: process.env.MASTER_KEY,
serverURL: process.env.SERVER_URL,
appName: process.env.APP_NAME,
graphQLServerURL: process.env.GRAPHQL_URL,
graphQLPath: process.env.GRAPHQL_PATH,
supportedPushLocales: ["en", "ar"],
production: process.env.PRODUCTION
},
],
users: [{
user: "bahaa",
pass: "y$RvjUJx0SLM66/SqzT.oyJ.49AsrUHIsgj0AEEFdn5HLRvUw6L0UeG"
}],
trustProxy: process.env.TRUST_PROXY,
// Use https://www.bcrypt-generator.com.
useEncryptedPasswords: true
}, { allowInsecureHTTP: process.env.DASHBOARD_ALLOW_INSECURE_HTTP });
// GraphQl Api Setup
var parseGraphQLServer = new ParseGraphQLServer(api, {
graphQLPath: '/graphql', playgroundPath: '/playground'
})
var parseApp = express();
// Serve static assets from the /public folder
parseApp.use(express.static(path.join(__dirname, '/public')));
// Serve the Parse API on the /parse URL prefix
parseApp.use(process.env.PARSE_MOUNT, api.app);
// Serve the Dasboard on the /dashboard URL prefix
parseApp.use(process.env.DASHBOARD_MOUNT, dashboard);
// Mounts the GraphQL API
parseGraphQLServer.applyGraphQL(parseApp);
parseApp.get('/', function (req, res) {
res.sendFile(path.join(__dirname, '/public/index.html'));
});
var httpServerParseApi = require('http').createServer(parseApp);
httpServerParseApi.listen(process.env.PARSE_PORT, function () {
console.log('api + dashboard + graphql running on port ' + process.env.PARSE_PORT + '.');
});
问题已解决 我的 ServerUrl 值为:http://localhost:1337/parse 所以我将其更改为 https://mydomian.com/parse 并且没有任何问题