Proxy static files for dev/prod servers
Currently, if I understood this correctly, there is a main nginx server for dev/prod etc which proxies requests to dev/prod backend API servers. This has one major drawback: the static files are served by the haskell backend API which loads our API unnecessarily. We should add another proxy (nginx or caddy) in dev/prod servers so that they serve static files and proxy other requests to the API.
So instead of:
nginx
-> dev API
we would have:
nginx
-> nginx on dev
-> dev API
and nginx on dev
will serve static files from dev
.
If we were to use caddy on dev
machines, the Caddyfile
is quite simple:
http://localhost:8108 {
reverse_proxy /api/* localhost:8008
reverse_proxy /gql/* localhost:8008
root * /srv/purescript-gargantext/dist
file_server
}
(no that the 'http' part means caddy will not ask for letsencrypt certs -- we don't need that here as it's for internal routing).
If we were to merge #341 , we would also have to add websockets /ws
url.