Reproduction
- Pull up something with a wildcard tag which matches lots of tags. I ran into this while using the
django~
tag. - Change the sort order to
featured
(or any of the links belowAsk Question
). Fordjango~
, you end up at a URL like this.- The response headers indicate a 404 response, even though the page is blank.
The URL is 2,262 characters long, which the browser and/or server doesn't handle well.
Microsoft has documented their maximum URL length in IE at 2,083 characters. I don't know if other browsers have different limitations, but Firefox and Safari both receive 404 errors.- If you do this on wildcard tags which match much fewer tags, such as this one (for
python~
), everything works as expected.
Solution?
The first thing that came to my mind was to reuse the tagname
being passed in. When constructing links, use a sanitized version of the original tagname
string. The current functionality appears to construct the URL using the tags which resulted from the search. Using the original tagname
string would result in a URL like this one (shown below), when clicking on featured
under django~
.
https://stackoverflow.com/questions/tagged?tagnames=django~&sort=featured