vite-plugin-rpx 0.11.40 → 0.11.41

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 +18 -3
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -26199,7 +26199,7 @@ init_utils();
26199
26199
  var package_default = {
26200
26200
  name: "@stacksjs/rpx",
26201
26201
  type: "module",
26202
- version: "0.11.40",
26202
+ version: "0.11.41",
26203
26203
  description: "A modern and smart reverse proxy.",
26204
26204
  author: "Chris Breuer <chris@stacksjs.org>",
26205
26205
  license: "MIT",
@@ -26621,7 +26621,7 @@ async function setupProxy(options) {
26621
26621
  const { from, originalFrom, to, sourceUrl, ssl, verbose, cleanup: cleanupOptions, vitePluginUsage, changeOrigin, cleanUrls } = options;
26622
26622
  const httpPort = 80;
26623
26623
  const httpsPort = 443;
26624
- const hostname = "0.0.0.0";
26624
+ const hostname = bindHostname();
26625
26625
  const portManager2 = options.portManager || globalPortManager;
26626
26626
  const hostsEnabled = isHostsManagementEnabled(options);
26627
26627
  try {
@@ -27140,6 +27140,21 @@ async function collectRouteEntries(proxyOptions, hostsEnabled, verbose) {
27140
27140
  }
27141
27141
  return routeEntries;
27142
27142
  }
27143
+ var cachedBindHostname = null;
27144
+ function bindHostname() {
27145
+ if (process31.env.RPX_BIND_HOSTNAME)
27146
+ return process31.env.RPX_BIND_HOSTNAME;
27147
+ if (cachedBindHostname)
27148
+ return cachedBindHostname;
27149
+ try {
27150
+ const interfaces = Object.values(os3.networkInterfaces()).flat();
27151
+ const hasIpv6 = interfaces.some((entry) => entry && entry.family === "IPv6");
27152
+ cachedBindHostname = hasIpv6 ? "::" : "0.0.0.0";
27153
+ } catch {
27154
+ cachedBindHostname = "0.0.0.0";
27155
+ }
27156
+ return cachedBindHostname;
27157
+ }
27143
27158
  function createSharedProxyServer(opts) {
27144
27159
  const { routeEntries, listenPort, sslConfig, originGuard, verbose } = opts;
27145
27160
  const routingTable = buildHostRoutes(routeEntries);
@@ -27149,7 +27164,7 @@ function createSharedProxyServer(opts) {
27149
27164
  try {
27150
27165
  const bunServer = Bun.serve({
27151
27166
  port: listenPort,
27152
- hostname: "0.0.0.0",
27167
+ hostname: bindHostname(),
27153
27168
  reusePort: shouldReusePort(),
27154
27169
  ...sslConfig ? {
27155
27170
  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.41",
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.41",
51
51
  "@stacksjs/tlsx": "^0.13.13"
52
52
  },
53
53
  "simple-git-hooks": {