我对Parse有一个奇怪的问题: 我在使用nginx应用的HTTPS协议进行群集时使用它,如果我使用来自http网站的非群集版本,则会触发所有来自实时查询的事件,但是从HTTPS和群集版本只有几次事件是解雇了,这是我的服务器的index.js
var express = require('express');
var bodyParser = require('body-parser');
var ParseServer = require('parse-server').ParseServer;
var path = require('path');
var fs = require('fs');
var api = new ParseServer({
databaseURI: 'mongodb://' + process.env.MONGO_USER + ':' + process.env.MONGO_$
cloud: process.env.CLOUD,
appId: 'appid',
masterKey: 'master',
logsFolder: process.env.LOGS,
maxUploadSize: "128mb",
verbose: false,
facebookAppIds: ['fb'],
oauth: {
twitter: {
consumer_key: "ck",
consumer_secret: "cs",
}},
clientKey: 'ck',
javascriptKey: 'jk',
restKey: 'rk',
publicServerURL: process.env.PUBLIC_URL,
serverURL: process.env.SERVER_URL,
liveQuery: {
classNames: ["Notification", "ChatMessage", "Chat"]
}});
var app = express();
app.use(bodyParser.json({limit: '200mb'}));
api.use(bodyParser.urlencoded({limit: '200mb', extended: true}));
api.use(bodyParser.raw({limit: '200mb'}));
app.use('/public', express.static(path.join(__dirname, '/public')));
app.use('/parse', api);
app.get('/', function(req, res) {
res.status(200).send('Server Running ..');
});
var httpServer = require('http').createServer(app);
httpServer.listen(process.env.PORT, function() {
console.log('We are rocking, baby');
});
ParseServer.createLiveQueryServer(httpServer);
那是我的nginx配置:
server {
listen 80;
server_name sec;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name xxx.com;
ssl_certificate /etc/letsencrypt/live/xxx.com-0001/fullchain.pem$
ssl_certificate_key /etc/letsencrypt/live/xxx.com-0001/privkey.p$
client_max_body_size 200M;
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:3000;
# Web Socket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location '/.well-known/acme-challenge' {
default_type "text/plain";
root /var/www/xxxy;
}
}
任何建议都将非常感激 提前谢谢
答案 0 :(得分:1)
找出解决方案: 如果你有一个集群服务器,你必须使用redis来缓存所有实时查询事件,因为如果不是,你将始终只在你连接的集群上监听,这似乎不关心其他集群中的事件