@fedify/express 2.2.0-dev.635 → 2.2.0-dev.652
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 +13 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -31,3 +31,16 @@ app.use(integrateFederation(federation, (req) => "context data goes here"));
|
|
|
31
31
|
[@fedify@hollo.social]: https://hollo.social/@fedify
|
|
32
32
|
[Fedify]: https://fedify.dev/
|
|
33
33
|
[Express]: https://expressjs.com/
|
|
34
|
+
|
|
35
|
+
### Reverse proxy with Express 4.x
|
|
36
|
+
|
|
37
|
+
If your application uses Express 4.x behind a reverse proxy with a non-standard
|
|
38
|
+
port (e.g., `Host: example.com:8080`), the reconstructed request URL may lose
|
|
39
|
+
the port number. This is because Express 4.x's `req.host` (which respects
|
|
40
|
+
[`trust proxy`][trust proxy]) strips the port from the `Host` header.
|
|
41
|
+
|
|
42
|
+
This issue does not occur with Express 5.x, where `req.host` retains the port.
|
|
43
|
+
If you rely on `trust proxy` and your origin includes a non-standard port, we
|
|
44
|
+
recommend upgrading to Express 5.
|
|
45
|
+
|
|
46
|
+
[trust proxy]: https://expressjs.com/en/guide/behind-proxies.html
|
package/dist/index.cjs
CHANGED
|
@@ -41,7 +41,7 @@ function integrateFederation(federation, contextDataFactory) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
function fromERequest(req) {
|
|
44
|
-
const url = `${req.protocol}://${req.host
|
|
44
|
+
const url = `${req.protocol}://${req.host}${req.url}`;
|
|
45
45
|
const headers = new Headers();
|
|
46
46
|
for (const [key, value] of Object.entries(req.headers)) if (Array.isArray(value)) for (const v of value) headers.append(key, v);
|
|
47
47
|
else if (typeof value === "string") headers.append(key, value);
|
package/dist/index.js
CHANGED
|
@@ -40,7 +40,7 @@ function integrateFederation(federation, contextDataFactory) {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
function fromERequest(req) {
|
|
43
|
-
const url = `${req.protocol}://${req.host
|
|
43
|
+
const url = `${req.protocol}://${req.host}${req.url}`;
|
|
44
44
|
const headers = new Headers();
|
|
45
45
|
for (const [key, value] of Object.entries(req.headers)) if (Array.isArray(value)) for (const v of value) headers.append(key, v);
|
|
46
46
|
else if (typeof value === "string") headers.append(key, value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/express",
|
|
3
|
-
"version": "2.2.0-dev.
|
|
3
|
+
"version": "2.2.0-dev.652+68880cdf",
|
|
4
4
|
"description": "Integrate Fedify with Express",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Fedify",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"package.json"
|
|
49
49
|
],
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"express": "
|
|
52
|
-
"@fedify/fedify": "^2.2.0-dev.
|
|
51
|
+
"express": ">=4.0.0",
|
|
52
|
+
"@fedify/fedify": "^2.2.0-dev.652+68880cdf"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/express": "^4.0.0",
|