Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass all parameters to onProxyReq in proxy configuration #1083

Merged
merged 2 commits into from
Apr 26, 2018
Merged

Pass all parameters to onProxyReq in proxy configuration #1083

merged 2 commits into from
Apr 26, 2018

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