Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running neuroglancer behind nginx with another server #501

Open
copypasteearth opened this issue Nov 3, 2023 · 6 comments
Open

Running neuroglancer behind nginx with another server #501

copypasteearth opened this issue Nov 3, 2023 · 6 comments

Comments

@copypasteearth
Copy link

Hello all i am trying to run 2 servers behind nginx, one is neuroglancer and one is a custom server that we made.
here is the config

`server {
listen 443 ssl;
server_name localhost;

   ssl_certificate      certs;
   ssl_certificate_key keys;

   ssl_session_cache    shared:SSL:1m;
   ssl_session_timeout  5m;

   ssl_ciphers  HIGH:!aNULL:!MD5;
   ssl_prefer_server_ciphers  on;

   location / {
       proxy_pass http://127.0.0.1:8080;
   }
   location /neuroglancer/ {
       proxy_pass http://127.0.0.1:5000;
   proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
   }
}
include servers/*;

}
`
the location of /neuroglancer/ does not seem to work,
this is what i get in the console
Screenshot 2023-11-02 at 10 20 11 PM

and it is just a white screen. Is it possible to proxy to neuroglancer along with another server?

@jbms
Copy link
Collaborator

jbms commented Nov 3, 2023

It looks like your nginx config is serving the wrong thing for the main.bundle.js file, probably html.

Note that neuroglancer doesn't need a custom server except for the Python integration. The dev-server is just for development purposes and just adds auto-reload functionality. Instead you can just configure nginx to serve the neuroglancer client files directly.

@copypasteearth
Copy link
Author

@jbms I tried serving the built neuroglancer files, and it does the same thing

@copypasteearth
Copy link
Author

@jbms it works if i make it at the root
location / {
root /Users/johnrowan/Documents/neuroglancer/dist/min;
index index.html;
}

   but it will not work if I try to put it somewhere else
   location /neuroglancer/ {
      root   /Users/johnrowan/Documents/neuroglancer/dist/min;
        index  index.html;
   }

@xgui3783
Copy link

xgui3783 commented Nov 3, 2023

if my nginx foo is still up to date, you will need to use a rewrite directive

i.e.

   location /neuroglancer/ {
        rewrite ^/neuroglancer/(.*)$ /$1;
        root   /Users/johnrowan/Documents/neuroglancer/dist/min;
        index  index.html;
   }

The current configuration (IIRC) will serve static files at /Users/johnrowan/Documents/neuroglancer/dist/min/neuroglancer/

which does not exist, and thus will return 404

@copypasteearth
Copy link
Author

@xgui3783 if I refresh the browser it takes me to the location / path, is there something i can do there?

@xgui3783
Copy link

@xgui3783 if I refresh the browser it takes me to the location / path, is there something i can do there?

Just so I understand the situation, can you confirm this is what's happening:

1/ http://localhost:{PORT}/neuroglancer/ works as expected (you can add layers etc)
2/ reload the page
3/ you are now at http://localhost:{PORT}/

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants