@stacksjs/rpx 0.3.1 → 0.4.0

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.
package/README.md CHANGED
@@ -65,10 +65,10 @@ startProxy(config)
65
65
  ### CLI
66
66
 
67
67
  ```bash
68
- reverse-proxy --from localhost:3000 --to my-project.localhost
69
- reverse-proxy --from localhost:8080 --to my-project.test --keyPath ./key.pem --certPath ./cert.pem
70
- reverse-proxy --help
71
- reverse-proxy --version
68
+ rpx --from localhost:3000 --to my-project.localhost
69
+ rpx --from localhost:8080 --to my-project.test --keyPath ./key.pem --certPath ./cert.pem
70
+ rpx --help
71
+ rpx --version
72
72
  ```
73
73
 
74
74
  ## Configuration
@@ -77,7 +77,7 @@ The Reverse Proxy can be configured using a `reverse-proxy.config.ts` _(or `reve
77
77
 
78
78
  ```ts
79
79
  // reverse-proxy.config.{ts,js}
80
- import type { ReverseProxyOptions } from './src/types'
80
+ import type { ReverseProxyOptions } from '@stacksjs/rpx'
81
81
  import os from 'node:os'
82
82
  import path from 'node:path'
83
83
 
@@ -106,6 +106,40 @@ const config: ReverseProxyOptions = {
106
106
  export default config
107
107
  ```
108
108
 
109
+ In case you are trying to start multiple proxies, you may use this configuration:
110
+
111
+ ```ts
112
+ // reverse-proxy.config.{ts,js}
113
+ import type { ReverseProxyOptions } from '@stacksjs/rpx'
114
+ import os from 'node:os'
115
+ import path from 'node:path'
116
+
117
+ const config: ReverseProxyOptions = {
118
+ https: { // https: true -> also works with sensible defaults
119
+ caCertPath: path.join(os.homedir(), '.stacks', 'ssl', `stacks.localhost.ca.crt`),
120
+ certPath: path.join(os.homedir(), '.stacks', 'ssl', `stacks.localhost.crt`),
121
+ keyPath: path.join(os.homedir(), '.stacks', 'ssl', `stacks.localhost.crt.key`),
122
+ },
123
+
124
+ etcHostsCleanup: true,
125
+
126
+ proxies: [
127
+ {
128
+ from: 'localhost:5173',
129
+ to: 'my-app.localhost',
130
+ },
131
+ {
132
+ from: 'localhost:5174',
133
+ to: 'my-api.local',
134
+ },
135
+ ],
136
+
137
+ verbose: true,
138
+ }
139
+
140
+ export default config
141
+ ```
142
+
109
143
  _Then run:_
110
144
 
111
145
  ```bash