Skip to content

Commit 896f9d9

Browse files
Fix issue of overwriting other link headers
1 parent 9cd3c40 commit 896f9d9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

solid/lib/Middleware/SolidCorsMiddleware.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ public function afterController($controller, $methodName, Response $response) {
3636

3737
$pubsub = getenv("PUBSUB_URL") ?: "http://pubsub:8080";
3838
$response->addHeader('updates-via', $pubsub);
39-
$response->addHeader('Link', '</.well-known/solid>; rel="http://www.w3.org/ns/solid#storageDescription"');
39+
$linkHeaders = '</.well-known/solid>; rel="http://www.w3.org/ns/solid#storageDescription"';
40+
$existingHeaders = $response->getHeaders();
41+
if (isset($existingHeaders['Link'])) { // careful - this dictionary key is case sensitive here
42+
$linkHeaders .= ', ' . $existingHeaders['Link'];
43+
}
44+
$response->addHeader('Link', $linkHeaders);
4045

4146
// Note that apart from these, the Link header with rel="acl" and the WAC-Allow header
4247
// are already added by these lines in vendor/pdsinterop/solid-auth:

0 commit comments

Comments
 (0)