server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name rm.example.com; include ssl.conf; location / { client_max_body_size 0; proxy_cache_bypass $http_upgrade; proxy_set_header Upgrade $http_upgrade; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Host $remote_addr; proxy_set_header Host $http_host; proxy_set_header Connection "upgrade"; proxy_pass http://127.0.0.1:3000; } location /token/device/new { rewrite ^ /token/json/2/device/new; } location /token/user/new { rewrite ^ /token/json/2/user/new; } } server { listen 80; listen [::]:80; server_name rm.example.com; return 301 https://$host$request_uri; }