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

Custom resolvers not working for HTTPS to HTTP? #312

Open
NN-Binary opened this issue Feb 15, 2025 · 0 comments
Open

Custom resolvers not working for HTTPS to HTTP? #312

NN-Binary opened this issue Feb 15, 2025 · 0 comments

Comments

@NN-Binary
Copy link

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.

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

1 participant