Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

views: signposting: fix: fallback to level 2 linkset if collections size too big to control link header size #1966

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ptamarit
Copy link
Member

@ptamarit ptamarit commented Feb 24, 2025

@ptamarit ptamarit changed the title 2937 fair signposting level 1 collections length views: signposting: fix limit collections length to control link header size Feb 24, 2025
@ptamarit ptamarit force-pushed the 2937-fair-signposting-level-1-collections-length branch from b5776a4 to aa0c5f2 Compare February 24, 2025 16:25
"""
for key in ["author", "item", "license"]:
if key in data:
data[key] = data[key][:5]
Copy link
Member Author

@ptamarit ptamarit Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of an arbitrary limit:

  • For author, we only include the ORCID URL, so the length is under control
  • For item, filenames have a limit of 255 characters, so we should test on a deployed environment with filenames of this length
  • For license, custom ones can have very long URLs (I tried with 5000 characters), since the marshmallow URL validator does not check for length, so this might be a big problem

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine in this case to have the "magic" 5, since passing config to the serializers from the app is quite cumbersome (and breaks the assumption that serializers don't depend on Flask application context).

@ptamarit ptamarit requested a review from slint February 24, 2025 16:26
@ptamarit ptamarit force-pushed the 2937-fair-signposting-level-1-collections-length branch from aa0c5f2 to 9e95ed5 Compare February 25, 2025 14:39
@ptamarit ptamarit changed the title views: signposting: fix limit collections length to control link header size views: signposting: fix: fallback to level 2 linkset if collections size too big to control link header size Feb 25, 2025
Copy link
Member

@slint slint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and thanks for the nice tests :)

@ptamarit
Copy link
Member Author

ptamarit commented Mar 4, 2025

Another way of avoid this problem is to configure nginx to allow for bigger response headers with:

    # Allow for larger HTTP response headers for FAIR signposting
    # level 1 support (see invenio-app-rdm#2937)
    uwsgi_buffers 8 16k;
    uwsgi_buffer_size 16k;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FAIR signposting level 1 support (HTTP Link headers & link rel item)
2 participants