both front and back ends are on the same CVM.
vue is deployed on nginx, using port 80 and port 8081 on springboot. After the project starts, both vue and backend interfaces can be accessed on my local computer. Sending post requests under the vue path is also a way to get backend interfaces, but requests sent from vue cannot call the interface. The project has done cross-domain work in springboot. And there is a strange problem is that after I started the jar package of springboot locally, the foreground accessed the interface, which means that the background on the server does not work, and the front end accesses my local enabled service directly, but what I want to achieve is that both the front and back ends are running on the server. Has anyone ever encountered a similar situation, or is it my network or linux setting problem?
,config.js
login: function () {
axios.post("http://127.0.0.1:8081/login",
{"account": this.form.account, "password": this.form.password})
.then(
response => {
if (response.status === 200) {
sessionStorage.setItem("token", true)
sessionStorage.setItem("user", response.data.username)
if (response.data.msg === "success") {
// this.$message.success(response.data.msg)
this.$router.push("/manager")
} else {
this.$message.error(response.data.msg)
}
} else {
this.$message.error(response.data.msg)
}
})
.catch(
response => {
alert("fail")
})
}