I have a vue app which calls the backend through express. When I add an image to a request the request is not redirected to the backend. However, when I call the backend directly from the vue app, without express, the request is handeled correctly. The image gets lost somehow on the way.
Vue-code:
uploadImage(){
this.loadingImage = true
const url = "/person/"+localStorage.getItem("userUuid")+"/picture";
var config = {headers: {"Authorization": "Bearer "+localStorage.getItem("token")}};
const fd = new FormData();
fd.append('image', this.picture, this.picture.name)
this.$http.post(url, fd, config)
.then((response) => {
console.log(response)
this.loadingImage = false
//window.location.reload()
})
.catch((error) => {
console.log(error)
})
app.js
const proxy = require('express-http-proxy');
const express = require('express')
const fileUpload = require('express-fileupload');
const app = express();
app.post('/person/:id/picture', proxy(config.backendURL, {
filter: function(req, res) {return checkBearer(req, res)}
}));