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

feat(gateway): add DisableHTMLErrors option #463

Merged
merged 1 commit into from
Sep 21, 2023
Merged

feat(gateway): add DisableHTMLErrors option #463

merged 1 commit into from
Sep 21, 2023

Conversation

hacdias
Copy link
Member

@hacdias hacdias commented Sep 19, 2023

This adds a new option DisableHTMLErrors to gateway.Config. If this is true, then the errors will always be returned as text/plain with the raw error message. This will need to be bubbled up to Kubo, which will then allow ipfs.io to have a better insight into the error messages.

This also allows users of boxo/gateway library to do white-label hosting, without IPFS branding on error pages.

cc @cewood @mcamou

@codecov
Copy link

codecov bot commented Sep 19, 2023

Codecov Report

Merging #463 (3acb593) into main (0d10169) will decrease coverage by 0.09%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #463      +/-   ##
==========================================
- Coverage   66.41%   66.32%   -0.09%     
==========================================
  Files         207      204       -3     
  Lines       24692    24621      -71     
==========================================
- Hits        16398    16329      -69     
+ Misses       6868     6862       -6     
- Partials     1426     1430       +4     
Files Changed Coverage Δ
gateway/gateway.go 93.75% <ø> (ø)
gateway/errors.go 86.84% <100.00%> (ø)

... and 13 files with indirect coverage changes

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

@hacdias I think this is a sensible flag to have here and in Kubo(no matter if this is used by bifrost infra or not).
HTML Error pages include IPFS brand and links to project docs, and users may want to disable that to have whitelabel hosting setup.

Just rename it, so it is more clear what it does, either:

  • ForcePlainTextErrors
  • DisableHTMLErrors ← imo preferable, does what it says, does not corner us into returning plain text error forever (we can start returning JSON instead, and this won't break or look awkward)

CHANGELOG.md Outdated Show resolved Hide resolved
@hacdias hacdias requested a review from lidel September 21, 2023 11:11
@hacdias hacdias changed the title feat(gateway): add RawError option feat(gateway): add DisableHTMLErrors option Sep 21, 2023
@hacdias hacdias marked this pull request as ready for review September 21, 2023 11:11
@hacdias hacdias requested a review from a team as a code owner September 21, 2023 11:11
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

This feature is now nice and clear, thanks! ❤️

Mind bubbling up to Kubo?

@hacdias hacdias enabled auto-merge (rebase) September 21, 2023 12:07
@hacdias hacdias merged commit 339ec17 into main Sep 21, 2023
16 checks passed
@hacdias hacdias deleted the raw-error branch September 21, 2023 12:19
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.

None yet

3 participants