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 with nginx reverse proxy #1123

Open
donutbrew opened this issue May 12, 2020 · 4 comments
Open

Running with nginx reverse proxy #1123

donutbrew opened this issue May 12, 2020 · 4 comments

Comments

@donutbrew
Copy link

donutbrew commented May 12, 2020

I've been trying to force auspice to run behind an nginx reverse proxy, and I wonder if anyone has had success doing this. This is super easy if I want to proxy https://server.xyz:80/ -> localhost:4000. Ideally, though, I want to run from https://server.xyz/auspice but there's all sorts of path messiness (i.e. auspice requests /dist/auspice.bundle.js and /charon urls) if I put the following into my nginx config:

location /auspice/ {
   proxy_pass http://127.0.0.1:4000/;
}

I realize this is slightly off topic, and more an nginx question, but it might be helpful to other folks who want to stand up auspice quickly. Hopefully there is someone better versed in node+reverse proxies than me here that can help out.

@jameshadfield
Copy link
Member

Tangentially, there would be value in allowing these hardcoded paths to be modified at compile time by auspice customisations. This is already possible for the /charon API address (code here, although there may be bugs as it is rarely used).

@rwilliams
Copy link

rwilliams commented May 18, 2020

I'm in the exact same situation. It would be sweet if we could add a root for the url in the auspice customisations.

@terrycojones
Copy link
Contributor

terrycojones commented Sep 11, 2021

I just saw the discussion of setting a serverAddress at https://docs.nextstrain.org/projects/auspice/en/stable/customise-client/api.html#specifying-the-api-server-address and though I haven't tried deploying it yet, I do see the string I gave in the JavaScript in the dist dir following auspice build.

But the text in dist/index.html still requests /dist/... which I guess should be changed to also use the server address (of course I can edit it manually, no problem).

I have been running a site behind nginx for a while now, but needed to specify top-level location blocks for /charon and /dist etc and pass them to the auspice server. E.g.,

    location /charon/ {
        proxy_pass         http://127.0.0.1:4000$request_uri;
        proxy_redirect     off;
        include proxy_params;
    }

A question, while I'm at it. Is it actually necessary to run auspice behind nginx if you've done your own build? It looks like the dist dir might be all that's needed, in which case the whole thing could just be served as static files by nginx (if you just want to deploy one build and not have a top-level view that lets you choose a dataset or narrative). But maybe that's wishful thinking? I know I can just try this out, and I will, but it's too late now...

Thanks!

@jameshadfield
Copy link
Member

jameshadfield commented Sep 13, 2021

which I guess should be changed to also use the server address

It would be nice to allow customisations of this. The javascript bundles (./dist/*js )are static and this address can't (yet) be customised. The client requests for the dataset files (JSONs) can, via serverAddress refers to. As we don't use these customisations internally this is low priority for us, but PRs / guides are welcome!

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

4 participants