Skip to content

Instantly share code, notes, and snippets.

@dskvr
Last active April 19, 2024 18:29
Show Gist options
  • Save dskvr/4ea1937bd5c2161249146bc1edd2682e to your computer and use it in GitHub Desktop.
Save dskvr/4ea1937bd5c2161249146bc1edd2682e to your computer and use it in GitHub Desktop.
nginx configuration tips for myrelay.page and strfry
#important!
map $http_accept $upstream {
default 127.0.0.1:8080;
application/nostr+json 127.0.0.1:7777;
}
server {
...other stuff
location / {
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
try_files /null @$http_upgrade;
}
location @websocket {
proxy_pass http://127.0.0.1:7777;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location @ {
add_header Access-Control-Allow-Headers *;
proxy_pass http://$upstream;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment