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

Invalid HTML response for gem docs from www.rubydoc.info (www subdomain) but valid when requesting from rubydoc.info (no subdomain) #185

Open
kjleitz opened this issue Jul 12, 2023 · 0 comments

Comments

@kjleitz
Copy link

kjleitz commented Jul 12, 2023

Background

I encountered this issue after visiting the RubyGems page for the latest version of the Adornable gem and clicking the "Documentation" link under "Links" in the sidebar.

I was taken to what should have been the documentation page on rubydoc.info, but it looked like this instead (Firefox):

screenshot of broken documentation page in Firefox

And similar in Chrome:

screenshot of broken documentation page in Chrome

Note that the address for this page was: https://www.rubydoc.info/gems/adornable/1.3.0, and it also happens at https://www.rubydoc.info/gems/adornable (no version specified in URL; latest version by default)

Investigation

Subsequent refreshes and hard-refreshes (without cache) did not fix the issue.

Looking at the Network tab in my browser's developer tools, I see that the actual response HTML is invalid. It is wrapped in [" + "]; i.e., the HTML is returned as a string at element 0 of a single-membered JSON array. This is returned no matter how many times I refresh/hard-refresh the page or use a different browser or use an incognito window.

The Cache-Control header in the response has a value of public, max-age=14400, for what it's worth, so it's probably cached server-side for at least four hours.

Now, if I remove the www. subdomain and go directly to https://rubydoc.info/gems/adornable/1.3.0 I see the following page (good/valid HTML):

image

The "latest version" page (no version specified in the URL) also looks good/valid when the www. subdomain is removed (i.e., https://rubydoc.info/gems/adornable).

Reproduction

I checked a few low-traffic gems using the rubydoc.info search to try to reproduce the issue, and was unsuccessful. I have a hypothesis that if www. is included in the first time a gem's documentation page is visited (and therefore built), then it will cache the invalid HTML document for some non-trivial amount of time.

To test that hypothesis, you would need to:

  1. Create a new gem, or a new version of an existing gem, and do not include a documentation config option in the gemspec (so that it defaults to rubydoc.info on rubygems.org)
  2. Publish it to rubygems.org with a gem build and a gem push
  3. DO NOT look the gem up on rubydoc.info or attempt to visit the documentation page except by the following steps
  4. Find the page for that gem on https://rubygems.org
  5. Click the "Documentation" link in the sidebar, under the "Links" header

...which I will try to do myself if I have some time.

Related

I believe this recent issue (#184) exhibits the same symptom(s) I described above. The author of that issue closed it because it had self-mitigated, but clearly this is an ongoing problem in some respect.

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

No branches or pull requests

1 participant