4

For a side project I'm trying to store some data user generated content in a url so they can easily share it without me hosting the data.

When hosting on GitHub Pages I get the message: Error: URI Too Long when I have a fairly long url like this.

According to What is the maximum possible length of a query string? there is no limit in the spec but it just depends on the implementation.

I've searched for the url length limit of GitHub pages in their docs and on Google but had no luck.

RayB
  • 2,096
  • 3
  • 24
  • 42
  • 3
    Why not store it in the fragment part instead? Or use a `data:` URI (which has no real length limit) which would contain a minimal Base64-encoded web-page with an embedded script that redirects to your GitHub Pages page? – Dai Oct 28 '20 at 01:08
  • Using a fragment is a great idea. I didn't realize that they were not passed to the server. What is the advantage to using the data uri? I'm not sure how it would help bypass the length limit. – RayB Oct 28 '20 at 01:25

1 Answers1

1

This was an interesting question because you're making get requests, so I actually tried this myself...in case of your url, the requests start failing at exactly 8202 characters, but still work for 8201 characters...the response code for failed requests is 414 and it is returned by github's nginx server.

So, if you wanted to get your url working, Github would have to up their header buffers as explained in this answer: How to set the allowed url length for a nginx request (error code: 414, uri too large)

Rok Sprogar
  • 2,261
  • 2
  • 17
  • 27
  • Not all browsers have the same URI length limit - some are less forgiving than others: https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers – Dai Oct 28 '20 at 03:24