Display Suite is causing duplicate entries in the Link response header. We discovered this as it's causing issue's with our Acquia Varnish layer.

Steps to reproduce (e.g. on simplytest.me):

1) Install standard Drupal profile
2) Create a "article" page
3) Check the response for the "Link" header, it should be something like:
Link:</node/1>; rel="canonical", </node/1>; rel="shortlink", </node/1/delete>; rel="delete-form", </node/1/edit>; rel="edit-form", </node/1/revisions>; rel="version-history", </node/1>; rel="revision", </node/1/manage_display>; rel="display"
4) Enable display suite, and set the display mode of the article content type to use the one column layout.
5) Re-check the Link response header, it will be something like:
Link:</node/1>; rel="canonical", </node/1>; rel="shortlink", </node/1/delete>; rel="delete-form", </node/1/edit>; rel="edit-form", </node/1/revisions>; rel="version-history", </node/1>; rel="revision", </node/1/manage_display>; rel="display", </node/1>; rel="canonical", </node/1>; rel="shortlink", </node/1/delete>; rel="delete-form", </node/1/edit>; rel="edit-form", </node/1/revisions>; rel="version-history", </node/1>; rel="revision", </node/1/manage_display>; rel="display"

As you can see there is duplication in the response.
We've seen this duplication happen more than twice two, once you embed other entities on the page.

Not quite sure why this is happening, it could be an indirect result of another issue or something different display suite is doing.
Any pointers on fixing this would be helpful.

Files: 
CommentFileSizeAuthor
#8 2861605-8.patch461 bytesswentel

Comments

Leon Kessler created an issue. See original summary.

anavarre’s picture

Tried to reproduce with the step-by-step from the issue summary.

Initial response headers:

$ curl -sSLIXGET -b "SSESSb52692e64e4ebd0211dd9482b5cdfadf=MJ2Z19QU4zSufRYhoG5vvhhlZa5ke7FmA1Js_H7uALE" https://dgz70.ply.st/node/1          
(snipped)
Link: </node/1>; rel="canonical", </node/1>; rel="shortlink", </node/1/delete>; rel="delete-form", </node/1/edit>; rel="edit-form", </node/1/revisions>; rel="version-history", </node/1>; rel="revision"

And after enabling and configuring DS as requested:

$ curl -sSLIXGET -b "SSESSb52692e64e4ebd0211dd9482b5cdfadf=MJ2Z19QU4zSufRYhoG5vvhhlZa5ke7FmA1Js_H7uALE" https://dgz70.ply.st/node/1
(snipped)
Link: </node/1>; rel="canonical", </node/1>; rel="shortlink", </node/1/delete>; rel="delete-form", </node/1/edit>; rel="edit-form", </node/1/revisions>; rel="version-history", </node/1>; rel="revision", </node/1/manage_display>; rel="display", </node/1>; rel="canonical", </node/1>; rel="shortlink", </node/1/delete>; rel="delete-form", </node/1/edit>; rel="edit-form", </node/1/revisions>; rel="version-history", </node/1>; rel="revision", </node/1/manage_display>; rel="display"
(snipped)
swentel’s picture

That's interesting, haven't checked myself yet. We don't take over the viewController, so not sure initially where it comes from ..
What happens if you would uncomment ds_entity_type_alter() ? (unless field ui is not enabled, then it won't matter either).

swentel’s picture

Did a quick check on my local machine and everything seems fine - apart from a different problem were I don't see the wrapper right now on the one column layout ..

Is it only display suite core that's enabled, or also extras, switch view mode ?

Leon Kessler’s picture

It's with only ds enabled (no extras or any other submodules). The only change that's required is switching an entity display to use the one column layout.

I've had a bit of a dig around in ds.module, disabling a few of the different functions (including ds_entity_type_alter). Still get duplicate headers outputted. It could be the problem is caused by something else, but I was able to replicate the issue on a fresh install on simplytest.me

swentel’s picture

@Leon Kessler - so on simplytest with display suite 8.x-2.x branch or 8.x-3.x (I suspect 8.x-2.x).

swentel’s picture

actually don't worry, I can reproduce, digging

swentel’s picture

Version: 8.x-3.x-dev » 8.x-2.x-dev
Status: Active » Needs review
FileSize
461 bytes

Can you try this patch ?

Leon Kessler’s picture

Status: Needs review » Reviewed & tested by the community

Great!
Tested this on my local and on simplytest.me and it fixes the issue.
Thanks.

  • swentel committed 3c31914 on 8.x-2.x
    Issue #2861605 by swentel: Duplicate Link response headers
    

  • swentel committed c4c69bb on 8.x-3.x
    Issue #2861605 by swentel: Duplicate Link response headers
    
swentel’s picture

Status: Reviewed & tested by the community » Fixed

Ok, thanks for confirming, committed and pushed to 8.x-2.x and 8.x-3.x