I have a vue frontend, and spring boot backend application. My application has multiple instances with different url paths (for example /instance1, /instance2), but uses the same build project - meaning every instances runs the same jar. Also the application serves static files - the index.html of the compiled vue application.
My problem is that the vue application needs to know dynamically from which url path to get all its static files, so for example when i get the index.html of instance1 it need to get all the assets from /instance1/assets
I read many answers to this problem which they all suggested basically to configure dynamically the webpack_public_path global variable like this first answer
so in my vue app I did this:
in main.js file:
import './publicpath'
import Vue from 'vue'
then in publicpath.js file:
__webpack_public_path__ = `/${window.location.pathname.split('/')[1]}/`
The problem with the answer linked above is that it only works for me when I run the application as a dev application (when running npm run serve on vue project). This doesn't work after building the project, and the build index.html is served by spring boot.
I couldn't find any answer that solved this problem so I would really appreciate any help
Thank you!