Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • N node-http-proxy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 482
    • Issues 482
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 102
    • Merge requests 102
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • http ... PARTY!
  • node-http-proxy
  • Issues
  • #791
Closed
Open
Issue created Mar 11, 2015 by Administrator@rootContributor

body parser before proxy request

Created by: nguyenxuantuong

I am wondering is there anyway to use body parse before proxy request. Here is my scenario: app.use(bodyParser.json()) app.use(bodyParser.urlencoded({ extended: false }));

proxy.on('proxyReq', function(proxyReq, req, res, options) { //Need to write custom logic to check for the parameter inside the body. -- so that it can add custom header or modify proxyReq body, etc... //for example: var userId = req.param("userId") -> this one only available with bodyParser declared //before this one (see abover) }); app.all(route, function(req, res){ //proxy request to target url return proxy.web(req, res, { target: config.localUrl + "/api"}, function(e) { return res.json(501, e.stack || e.error || e); }); });

The web application at target also uses its own bodyParser. But it seems that because the body parser being used twice, no response arrived after proxy the request to target. I am wondering if there is any way to work around that issue? Thank.

Assignee
Assign to
Time tracking