I finally fixed it using the devServer.public configuration option.
Below is my vue.config.js file:
module.exports = {
devServer: {
disableHostCheck: true,
port: 4000,
public: '0.0.0.0:4000'
},
publicPath: "https://stackoverflow.com/"
}
I got my answer from reading this.