vite-plugin-rpx 0.11.40 → 0.11.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +23 -5
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -23148,7 +23148,7 @@ function poolFor(hostPort, maxPerHost) {
23148
23148
  const idx = hostPort.lastIndexOf(":");
23149
23149
  const host = idx === -1 ? hostPort : hostPort.slice(0, idx);
23150
23150
  const port = idx === -1 ? 80 : Number(hostPort.slice(idx + 1));
23151
- pool = new UpstreamPool(host, port, maxPerHost, hostPort);
23151
+ pool = new UpstreamPool(host, port, maxPerHost ?? maxTotalConns(), hostPort);
23152
23152
  pools.set(hostPort, pool);
23153
23153
  }
23154
23154
  return pool;
@@ -23249,7 +23249,7 @@ async function proxyViaPool(reqOpts) {
23249
23249
  payload.set(head);
23250
23250
  payload.set(bodyBytes, head.length);
23251
23251
  }
23252
- const pool = poolFor(hostPort, reqOpts.maxPerHost ?? maxTotalConns());
23252
+ const pool = poolFor(hostPort, reqOpts.maxPerHost);
23253
23253
  for (let attempt = 0;; attempt++) {
23254
23254
  if (attempt > 0)
23255
23255
  await new Promise((resolve14) => {
@@ -24178,6 +24178,7 @@ async function readPair(serverName, certPath, keyPath, verbose) {
24178
24178
  }
24179
24179
  async function buildSniTlsConfig(cfg, verbose) {
24180
24180
  const bySrvName = new Map;
24181
+ const discoveredServerNames = cfg.certsDirServerNames ? new Set(cfg.certsDirServerNames) : undefined;
24181
24182
  if (cfg.certsDir) {
24182
24183
  let names = [];
24183
24184
  try {
@@ -24189,6 +24190,8 @@ async function buildSniTlsConfig(cfg, verbose) {
24189
24190
  const serverName = serverNameFromCertFilename(name);
24190
24191
  if (!serverName)
24191
24192
  continue;
24193
+ if (discoveredServerNames && !discoveredServerNames.has(serverName))
24194
+ continue;
24192
24195
  const base = name.slice(0, -".crt".length);
24193
24196
  bySrvName.set(serverName, {
24194
24197
  certPath: path4.join(cfg.certsDir, name),
@@ -26199,7 +26202,7 @@ init_utils();
26199
26202
  var package_default = {
26200
26203
  name: "@stacksjs/rpx",
26201
26204
  type: "module",
26202
- version: "0.11.40",
26205
+ version: "0.11.42",
26203
26206
  description: "A modern and smart reverse proxy.",
26204
26207
  author: "Chris Breuer <chris@stacksjs.org>",
26205
26208
  license: "MIT",
@@ -26621,7 +26624,7 @@ async function setupProxy(options) {
26621
26624
  const { from, originalFrom, to, sourceUrl, ssl, verbose, cleanup: cleanupOptions, vitePluginUsage, changeOrigin, cleanUrls } = options;
26622
26625
  const httpPort = 80;
26623
26626
  const httpsPort = 443;
26624
- const hostname = "0.0.0.0";
26627
+ const hostname = bindHostname();
26625
26628
  const portManager2 = options.portManager || globalPortManager;
26626
26629
  const hostsEnabled = isHostsManagementEnabled(options);
26627
26630
  try {
@@ -27140,6 +27143,21 @@ async function collectRouteEntries(proxyOptions, hostsEnabled, verbose) {
27140
27143
  }
27141
27144
  return routeEntries;
27142
27145
  }
27146
+ var cachedBindHostname = null;
27147
+ function bindHostname() {
27148
+ if (process31.env.RPX_BIND_HOSTNAME)
27149
+ return process31.env.RPX_BIND_HOSTNAME;
27150
+ if (cachedBindHostname)
27151
+ return cachedBindHostname;
27152
+ try {
27153
+ const interfaces = Object.values(os3.networkInterfaces()).flat();
27154
+ const hasIpv6 = interfaces.some((entry) => entry && entry.family === "IPv6");
27155
+ cachedBindHostname = hasIpv6 ? "::" : "0.0.0.0";
27156
+ } catch {
27157
+ cachedBindHostname = "0.0.0.0";
27158
+ }
27159
+ return cachedBindHostname;
27160
+ }
27143
27161
  function createSharedProxyServer(opts) {
27144
27162
  const { routeEntries, listenPort, sslConfig, originGuard, verbose } = opts;
27145
27163
  const routingTable = buildHostRoutes(routeEntries);
@@ -27149,7 +27167,7 @@ function createSharedProxyServer(opts) {
27149
27167
  try {
27150
27168
  const bunServer = Bun.serve({
27151
27169
  port: listenPort,
27152
- hostname: "0.0.0.0",
27170
+ hostname: bindHostname(),
27153
27171
  reusePort: shouldReusePort(),
27154
27172
  ...sslConfig ? {
27155
27173
  tls: withLowMemoryTls(Array.isArray(sslConfig) ? sslConfig.map((entry) => ({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-plugin-rpx",
3
3
  "type": "module",
4
- "version": "0.11.40",
4
+ "version": "0.11.42",
5
5
  "description": "A modern and smart reverse proxy. Vite plugin.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -47,7 +47,7 @@
47
47
  "typecheck": "bunx tsc --noEmit"
48
48
  },
49
49
  "dependencies": {
50
- "@stacksjs/rpx": "0.11.40",
50
+ "@stacksjs/rpx": "0.11.42",
51
51
  "@stacksjs/tlsx": "^0.13.13"
52
52
  },
53
53
  "simple-git-hooks": {