I get a net::ERR_EMPTY_RESPONSE error:
- only on deployed version, not localhost
- other GET-requests work
It downloads all my files from the ftp-server but it returns an error.:(
Flask Backend:
app = Flask(__name__)
cors = CORS(app)
@app.route('/downloadftp', methods=['POST'])
@cross_origin()
def download_all_ftp_data():
# connect to sever...
# download files...
for f in ftp.nlst():
fhandle = open(f, 'wb')
ftp.retrbinary('RETR ' + f, fhandle.write)
ftp.quit()
return 'OK 200'
React Frontend:
useEffect(() => {
axios
.post(`${process.env.REACT_APP_HOST}/downloadftp`, { content: "post" })
.then(res => {
console.log(res)
setError(false)
})
.catch(function (err) {
console.log(err)
setError(true)
})
}, [])