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

Proxy from https to https #21

Closed
Muhaah opened this issue Apr 6, 2018 · 3 comments
Closed

Proxy from https to https #21

Muhaah opened this issue Apr 6, 2018 · 3 comments

Comments

@Muhaah
Copy link

Muhaah commented Apr 6, 2018

Proxying to a https target are not working. Some option for this case would-be cool and an option to allow self-signed certificate from target (rejectUnauthorized: false).

@ronag
Copy link
Member

ronag commented Apr 6, 2018

You can achieve this using onReq, e.g:

server.on('request', (req, res) => {
  proxy.web(req, res, {
    hostname: 'localhost'
    port: 9000,
    onReq: (req, options) => https.request({
      ...options,
      rejectUnauthorized: false
    })
  }, err => {
    if (err) {
      console.error('proxy error', err)
    }
  })
})

@ronag ronag closed this as completed Apr 6, 2018
@Muhaah
Copy link
Author

Muhaah commented Apr 7, 2018

Works great 👍
And the request/response will be handled from node-http2-proxy?

@ronag
Copy link
Member

ronag commented Apr 7, 2018

Correct.

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

No branches or pull requests

2 participants