Skip to content

Conversation

davidhemphill
Copy link
Contributor

In the current version of vue-cli, one is able to use the onProxyReq callback to modify the request. This is useful for adding things such as client IDs and secrets for OAuth when one can't keep them secure client-side.

module.exports = {
  target: process.env.PROXY_URL,
  onProxyReq(proxyReq, req, res) {
    console.log(proxyReq, req, res)
    if (req.path == '/oauth/token') {
      req.body.client_id = process.env.CLIENT_ID
      req.body.client_secret = process.env.CLIENT_SECRET
    }
  },
}

The currently tagged beta 6 doesn't use a user-provided onProxyReq callback. The dev branch does, but it does not pass all the parameters to it:

onProxyReq (proxyReq) {
  if (usersOnProxyReq) {
    usersOnProxyReq(proxyReq)
  }
  // ...
},

It would be ideal if we could keep this functionality. :-)

@davidhemphill
Copy link
Contributor Author

Is there anything I can do to help you kind folks regarding this?

@yyx990803 yyx990803 merged commit 65ee2fa into vuejs:dev Apr 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants