the LiveQuery server is with Parse Server in my express app like so :
ParseServer.createLiveQueryServer(httpServer);
here is my nginx sites-available:
# HTTP - redirect all requests to HTTPS
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
return 301 https://$host$request_uri;
}
# HTTPS - serve HTML from /usr/share/nginx/html, proxy requests to /parse/
# through to Parse Server
server {
listen 443;
server_name my-domain.com;
root /usr/share/nginx/html;
index index.html index.htm;
ssl on;
# Use certificate and key provided by Let's Encrypt:
ssl_certificate /etc/letsencrypt/live/my-domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/my-domain.com/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
# Pass requests for /parse/ to Parse Server instance at localhost:1337
location /parse/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:1337/parse/;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_redirect off;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# Pass requests for /dashboard/ to Parse Server instance at localhost:4040
location /dashboard/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:4040/dashboard/;
proxy_set_header Host $http_host;
proxy_redirect off;
}
location / {
try_files $uri $uri/ =404;
}
}
so ever since i switched to https using nginx reverse proxy, the response is too slow and sometimes it wont even receive the response when i test creating objects in the dashboard.
I am planning to separate the livequery server with redis as stated in the wiki. hopefuly this will help
or I can use apache for this. anyone with similar issues to this?
I not sure whether this helps you. But I always needed this in the config to get websockets working at all.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
it is working, it is just way too slow than before. i will try this. plus isnt that basically the same as
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
i have added redis and it seems the response times are back to normal compared to before.
I have the same issue Please would you help me to seperate livequeryserver using redis?
the docs on parse server seems straightforward http://docs.parseplatform.org/parse-server/guide/#scalability
unfortunately the link is broken.
edited
Thanks, Actually the speed problem without Redis solved. but I have another problem; just one client get subscried and receive livequeries. just one of the android app in two devices get livequeries. I've tested with back4app api which was receiving queries in both devices simultaneously.
here is my nginx configuration:
```
location /parse/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:1337/parse/;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
gzip on;
gzip_comp_level 4;
gzip_types text/html text/plain text/css application/json application/x-javascript text/xml
```application/xml application/xml+rss text/j$
location /dashboard/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:4040/dashboard/;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_redirect off;
}
location / {
try_files $uri $uri/ =404;
}
is your certificate valid?
Yes It's valid. I used Let's encrypt and it renews automatically. LiveQuery is working for single client and I'm able to call parse api in SSL mode
For using redis . Is it enough to just install redis and set it's url in parse server config like following:
Should I use url other than parse server in getClient URI parameter?
let api = new ParseServer({
...,
liveQuery: {
classNames: ['Test', 'TestAgain'],
redisURL: 'redis://localhost:6379'
}
});
...
let httpServer = require('http').createServer(app);
httpServer.listen(port);
var parseLiveQueryServer = ParseServer.createLiveQueryServer(httpServer, {
...,
redisURL: 'redis://localhost:6379'
});
that is fine
How should I set another url address to LiveQuery server ?
use both, the document is vague on that part. check the source if you must
Thanks a lot @jjdp I've solved the problem by installing redis. you're great