redbird icon indicating copy to clipboard operation
redbird copied to clipboard

Custom resolvers not working for HTTPS to HTTP?

Open NN-Binary opened this issue 9 months ago • 0 comments

const ssl = { http2: false, port: 443, ip: bindIp };
try {
  ssl.key = fs.readFileSync(path.join(CERTS_PATH, 'key.pem'), 'utf8');
  ssl.cert = fs.readFileSync(path.join(CERTS_PATH, 'cert.pem'), 'utf8');
  console.log(`Loaded official certificates for ${DOMAIN}`);
} catch (err) {
  console.error(`Failed to load official certificates: ${err.message}`);
  process.exit(1);
}

// Custom resolver for our official domain (DOMAIN)
const officialResolver = {
  priority: 100,
  fn: (host, url, req) => {

      console.log('debug!')
      return {
        opts: {
          ssl: {
            key: path.join(CERTS_PATH, 'key.pem'),
            cert: path.join(CERTS_PATH, 'cert.pem')
          },
        },

        url: 'http://10.10.8.100:80'
      };

    }

  }

const redbird = require('redbird');
const proxy = new redbird.Redbird({
  port: 80,
  letsencrypt: {
    path: path.join(__dirname, 'certs'),
    port: 9999,
  },
  ssl,
  bunyan: false,
  resolvers: [
    officialResolver, 
    //customDomainResolver
  ],
  cluster: 8 // Enable cluster mode with 8 CPUs
});


};

I have tried a bit of everything but I can't seem to have:

HTTPs using my own cert (that should be in the custom resolver) to HTTP with a custom Resolver.

NN-Binary avatar Feb 15 '25 07:02 NN-Binary