Code Monkey home page Code Monkey logo

Comments (10)

ronag avatar ronag commented on July 20, 2024

Add where? This library doesn't create the http server.

from node-http2-proxy.

masx200 avatar masx200 commented on July 20, 2024

These options are the options that the TLS client can pass in when creating a tls connection. You can see the nodejs documentation.

from node-http2-proxy.

ronag avatar ronag commented on July 20, 2024

I still don't see where in the api for this library you would like this? Can you provide an example on how you would like to use it?

from node-http2-proxy.

masx200 avatar masx200 commented on July 20, 2024
const tls = require('tls');
const fs = require('fs');

const options = {
  // Necessary only if the server requires client certificate authentication.
  key: fs.readFileSync('client-key.pem'),
  cert: fs.readFileSync('client-cert.pem'),

  // Necessary only if the server uses a self-signed certificate.
  ca: [ fs.readFileSync('server-cert.pem') ],
rejectUnauthorized:false,
  // Necessary only if the server's cert isn't for "localhost".
  checkServerIdentity: () => { return null; },
};

const socket = tls.connect(8000, options, () => {})
  

from node-http2-proxy.

ronag avatar ronag commented on July 20, 2024

@masx200: that example has no relation to this library in its current form

from node-http2-proxy.

masx200 avatar masx200 commented on July 20, 2024
server.on('request', (req, res) => {
  proxy.web(req, res, {
ca:[ fs.readFileSync('server-cert.pem') ],
rejectUnauthorized:false,
protocol:"https",
    hostname: 'localhost'
    port: 9000
  }, defaultWebHandler)
})

from node-http2-proxy.

masx200 avatar masx200 commented on July 20, 2024

https://github.com/villadora/express-http-proxy#q-how-can-i-support-non-standard-certificate-chains

Q: How can I support non-standard certificate chains?
You can use the ability to decorate the proxy request prior to sending. See proxyReqOptDecorator for more details.

app.use('/', proxy('internalhost.example.com', {
  proxyReqOptDecorator: function(proxyReqOpts, originalReq) {
    proxyReqOpts.ca =  [caCert, intermediaryCert]
    return proxyReqOpts;
  }
})
Q: How to ignore self-signed certificates ?
You can set the rejectUnauthorized value in proxy request options prior to sending. See proxyReqOptDecorator for more details.

app.use('/', proxy('internalhost.example.com', {
  proxyReqOptDecorator: function(proxyReqOpts, originalReq) {
    proxyReqOpts.rejectUnauthorized = false
    return proxyReqOpts;
  }
}))


from node-http2-proxy.

ronag avatar ronag commented on July 20, 2024
  proxy.web(req, res, {
    hostname: 'localhost'
    port: 9000,
    onReq: (req, options) => http.request(options)
  }, defaultWebHandler)

from node-http2-proxy.

masx200 avatar masx200 commented on July 20, 2024
  proxy.web(req, res, {
    hostname: 'localhost'
    port: 9000,
    onReq: (req, options) => http.request(options)
  }, defaultWebHandler)

Such use will make the novice very confused. Novices ca nā€™t find how to set options to support servers that use self-signed certificates.

from node-http2-proxy.

ronag avatar ronag commented on July 20, 2024

Such use will make the novice very confused. Novices ca nā€™t find how to set options to support servers that use self-signed certificates.

Sure, PR is welcome.

from node-http2-proxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.