Skip to content

Commit 01effac

Browse files
committed
Use server.host over req.host when computing keystoreId.
1 parent 58ca344 commit 01effac

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# bedrock-kms-http ChangeLog
22

3+
## 22.2.0 - 2025-10-dd
4+
5+
### Changed
6+
- `helpers.getKeystoreId` will use `config.server.host` first if defined
7+
before falling back to `req.host` to improve reliability when operating
8+
behind a reverse proxy.
9+
310
## 22.1.0 - 2025-09-28
411

512
### Changed

lib/helpers.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
/*!
2-
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
2+
* Copyright (c) 2019-2025 Digital Bazaar, Inc. All rights reserved.
33
*/
4+
import * as bedrock from '@bedrock/core';
45
import forwarded from 'forwarded';
56
import ipaddr from 'ipaddr.js';
67

8+
const {config} = bedrock;
9+
710
export function getKeystoreId({host, req, localId, routes}) {
811
if(!host) {
9-
host = req.get('host');
12+
host = config.server.host || req.get('host');
1013
}
1114
return `https://${host}${routes.keystores}/${localId}`;
1215
}

0 commit comments

Comments
 (0)