am running some docker containers inside a virtual machine. As I come to understand, each docker container has a different ip, as well as the virtual machine itself of course. When trying to run a web-app on my local host machine, I access the page http://<vm's_ip_address>:3000.
When attempting to execute an action in this web app, the following error occurs: POST http://83.212.117.117/websites/evaluate 404 (Not Found)
The error happens on the handleSubmit(event) method of the following ResultPageDisplay file:
`handleSubmit(event) { event.preventDefault()
this.setState({statusCode: 2})
API.post(`websites/evaluate`, { url: this.state.userInput})
.then(res => {
let score = res.data.score
let url = res.data.url
let imageURI = res.data.image
// DEBUGGING PURPOSES
// console.log(res.data)
this.setState({result: {
score: score,
url: url,
imageURI: imageURI
}})
this.setState({statusCode: 3})
})
.catch(err => {
let failedURL = this.state.userInput
this.setState({result: {
score: null,
url: failedURL,
imageURI: null
}})
let status = err.response.status
// DEBUGGING PURPOSES
// console.log(status)
this.setState({statusCode: 4})
if (status === 500) {
this.setState({
statusCode: 5
})
}
})
}`
I am suspecting that the problem lies somewhere in the configuration files, like nginx.conf. I am also wondering if there is something wrong with some other file like server.js or api.js.
I tried modifying these files, by creating a reverse proxy to map the ports correctly, but I do not understand the whole concept pretty well and maybe I was doing it not correctly. My nginx.conf file is the following:
`upstream app {
server client:3000;
}
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://app;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}`