How do you configure all base path-related settings when serving a Quasar+Vite+Vuejs SPA from nginx behind a proxy? #17037
Replies: 1 comment
-
The way we configure the runtime aspects of our app is to |
Beta Was this translation helpful? Give feedback.
-
We have an SPA site (@quasar/app-vite@1.4.4) being served from an nginx container that's behind an nginx proxy (in kubernetes), such that any request from the Internet to the proxy for a URL beginning with, say,
https://1.2.3.4/my-ui
returnshttp://my-spa.acme.svc.cluster.local:8082
(that dns name is only resolvable inside the cluster). Therefore,https://1.2.3.4/my-ui/index.html
causeshttp://my-spa.acme.svc.cluster.local:8082/index.html
to be returned, and so on. We'd like to build our SPA once and only once without knowing what path it will be exposed as via the proxy. That ismy-ui
may change tomorrow tothe-other-ui
, and we need to be able to configure that at deployment time.What's the magic configuration of the SPA's base path (and all related configs) so that, when served via the proxy, the site just works? Recall that the SPA in the browser thinks it's coming from
https://1.2.3.4/my-ui
, but it's really coming from the nginx container behind the proxy.For reference, our nginx proxy (the one serving
https://1.2.3.4
) has a configuration similar to this:For the container we serve from inside the cluster (the ones serving
http://my-spa.acme.svc.cluster.local
), we simply copy the SPA'sdist/spa
directory into an nginx container at/usr/share/nginx/html
, and here is itsnginx.conf
:Beta Was this translation helpful? Give feedback.
All reactions