I am using express
with http-proxy
in my application. There's one file upload API which takes more than 2 minutes because I am uploading a file which is to be processed in the backend. when I hit it from browser, I get 504 timeout error after around 50 seconds. I don't know who is causing it. Express
or Node
or http-proxy
.
How do I check it ?
express code :-
'use strict'
const path = require('path')
const httpProxy = require('http-proxy')
const express = require('express')
const cookieParser = require('cookie-parser')
const app = express()
app.use(cookieParser())
app.use('/', express.static(path.resolve(__dirname, 'dist')))
const proxy = httpProxy.createProxyServer({ secure: false, proxyTimeout : 600000})
app.use('file-upload-api', (req, res) => {
proxy.web(req, res, { target: 'http://someurl' })})
})
app.use('/', express.static(path.resolve(__dirname, 'dist')))
var server = app.listen(6666, () => console.log('STARTED:', 6666, process.env.NODE_ENV));
path is like :- browser ---> express(node) ---> http-proxy ---> backend(java).