Skip to content

Instantly share code, notes, and snippets.

@movibe
Last active August 4, 2022 06:56
Show Gist options
  • Save movibe/8adbc2a5e3193060010c162c6ecdcd68 to your computer and use it in GitHub Desktop.
Save movibe/8adbc2a5e3193060010c162c6ecdcd68 to your computer and use it in GitHub Desktop.
Parse Server Nginx default
# 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 ssl;
server_name 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/domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
# Pass requests for /parse/ to Parse Server instance at localhost:1337
location / {
# prevents 502 bad gateway error
proxy_buffers 8 32k;
proxy_buffer_size 64k;
# redirect all HTTP traffic to localhost:8088;
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://0.0.0.0:1337/;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_redirect off;
# enables WS support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 999999999;
}
#location / {
# try_files $uri $uri/ =404;
#}
}
@elijahjcobb
Copy link

This works awesome!!! Thanks for sharing. I was running into problems where I would get a CORS error on a parse error because it wasn't passing the error back.

This fixed everything! 😄

@rommyarb
Copy link

Thank you!! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment