I created a vue app and deployed it into openshift. I am containerizing it, building it using npm run build and serving the static files to an express server to run the app on openshift. It works fine in openshift. But now when I proxy it from a different server, the script files in index.html after the build refer to an absolute path and not to a relative path, so when coming through the proxy request, the app tries to search for these files specified under that path under the proxy server instead of the host server. Any suggestions on how I could approach this?
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<meta name=viewport content="width=device-width,initial-scale=1">
<title>Test</title>
<link href=/static/css/app.f7ae04f9d2eb7064481.css
rel=stylesheet>
</head>
<body>
<div id=app></div>
<script type=text/javascript
src=/static/js/manifest.46a3384df62a03.js></script>
<script type=text/javascript
src=/static/js/vendor.1c9f4f5eeff1.js></script>
<script type=text/javascript src=/static/js/app.7fb63c85e086.js></script>
</body>
</html>
Adding my express code on how the static file is served
var express = require('express');
var path = require('path');
var serveStatic = require('serve-static');
app = express();
app.use(express.static(path.resolve('dist')));
app.get(/.*/, function(req, res) {
res.sendFile(path.resolve('dist') + "/index.html");
})
var port = process.env.PORT || 8080;
app.listen(port);
console.log('server started '+ port);
console.log('server started path'+ path.join(__dirname, '/./dist'));