@platformatic/composer 2.43.0 → 2.44.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.
Files changed (3) hide show
  1. package/lib/proxy.js +12 -9
  2. package/package.json +10 -10
  3. package/schema.json +1 -1
package/lib/proxy.js CHANGED
@@ -46,7 +46,7 @@ async function resolveServiceProxyParameters (service) {
46
46
 
47
47
  module.exports = fp(async function (app, opts) {
48
48
  const meta = { proxies: {} }
49
- const allDomains = opts.services.map(s => s.proxy?.hostname).filter(Boolean)
49
+ const hostnameLessProxies = []
50
50
 
51
51
  for (const service of opts.services) {
52
52
  if (!service.proxy) {
@@ -207,7 +207,7 @@ module.exports = fp(async function (app, opts) {
207
207
 
208
208
  return headers
209
209
  },
210
- onResponse: (request, reply, res) => {
210
+ onResponse: (_, reply, res) => {
211
211
  app.openTelemetry?.endHTTPSpanClient(reply.request.proxedCallSpan, {
212
212
  statusCode: reply.statusCode,
213
213
  headers: res.headers
@@ -217,8 +217,9 @@ module.exports = fp(async function (app, opts) {
217
217
  }
218
218
  }
219
219
 
220
+ hostnameLessProxies.push(proxyOptions)
221
+
220
222
  const host = service.proxy?.hostname
221
- const notHost = allDomains.filter(d => d !== host)
222
223
 
223
224
  if (host) {
224
225
  await app.register(httpProxy, {
@@ -226,14 +227,16 @@ module.exports = fp(async function (app, opts) {
226
227
  prefix: '/',
227
228
  constraints: { host }
228
229
  })
230
+ }
231
+ }
229
232
 
230
- await app.register(httpProxy, {
231
- ...proxyOptions,
232
- ...(notHost.length ? { constraints: { notHost } } : {})
233
- })
234
- } else {
235
- await app.register(httpProxy, proxyOptions)
233
+ const hostnames = opts.services.map(s => s.proxy?.hostname).filter(Boolean)
234
+ for (const options of hostnameLessProxies) {
235
+ if (hostnames.length > 0) {
236
+ options.constraints = { notHost: hostnames }
236
237
  }
238
+
239
+ await app.register(httpProxy, options)
237
240
  }
238
241
 
239
242
  opts.context?.stackable?.registerMeta(meta)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/composer",
3
- "version": "2.43.0",
3
+ "version": "2.44.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -31,9 +31,9 @@
31
31
  "typescript": "^5.5.4",
32
32
  "why-is-node-running": "2",
33
33
  "ws": "^8.16.0",
34
- "@platformatic/client": "2.43.0",
35
- "@platformatic/db": "2.43.0",
36
- "@platformatic/config": "2.43.0"
34
+ "@platformatic/client": "2.44.0",
35
+ "@platformatic/config": "2.44.0",
36
+ "@platformatic/db": "2.44.0"
37
37
  },
38
38
  "dependencies": {
39
39
  "@fastify/error": "^4.0.0",
@@ -67,12 +67,12 @@
67
67
  "rfdc": "^1.3.1",
68
68
  "semgrator": "^0.3.0",
69
69
  "undici": "^7.0.0",
70
- "@platformatic/config": "2.43.0",
71
- "@platformatic/generators": "2.43.0",
72
- "@platformatic/scalar-theme": "2.43.0",
73
- "@platformatic/telemetry": "2.43.0",
74
- "@platformatic/service": "2.43.0",
75
- "@platformatic/utils": "^2.43.0"
70
+ "@platformatic/config": "2.44.0",
71
+ "@platformatic/generators": "2.44.0",
72
+ "@platformatic/scalar-theme": "2.44.0",
73
+ "@platformatic/telemetry": "2.44.0",
74
+ "@platformatic/service": "2.44.0",
75
+ "@platformatic/utils": "^2.44.0"
76
76
  },
77
77
  "scripts": {
78
78
  "test": "pnpm run lint && borp -T --timeout=300000 -c 1 && tsd",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/composer/2.43.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/composer/2.44.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Composer",
5
5
  "type": "object",