Page MenuHomePhabricator

Pywikibot documentation showing broken directory listing
Closed, ResolvedPublic

Description

https://doc.wikimedia.org/pywikibot shows a directory listing instead of loading index.html

Also the directory listing links are broken, as they link to /... instead of /pywikibot/...

https://doc.wikimedia.org/pywikibot/ works.

Event Timeline

Xqt triaged this task as Low priority.Apr 8 2016, 10:53 AM
Xqt subscribed.

There is an additional problem: You cannot load any of the listed files because the /pywikibot folder isn't included into the link.

At this moment https://doc.wikimedia.org/pywikibot is giving 403 response:

Forbidden

You don't have permission to access /pywikibot on this server.
zhuyifei1999 added a subscriber: Dzahn.

@Dzahn could you look into this? Most other redirects do work properly, but not pywikibot:

$ curl -sI https://doc.wikimedia.org/oojs | grep -P 'Location|HTTP'
HTTP/1.1 301 Moved Permanently
Location: oojs/
$ curl -sI https://doc.wikimedia.org/pywikibot | grep -P 'Location|HTTP'
HTTP/1.1 403 Forbidden

The apache rule checks for directory. Symlink?

Dvorapa subscribed.

Probably we could also ask Release-Engineering-Team for help as they take care of doc.wikimedia.org.

I thought this is because of this, but maybe i'm wrong:

./puppet/modules/contint/templates/apache/doc.wikimedia.org.erb

# T95164
DirectorySlash Off
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ https://doc.wikimedia.org/$1/ [R=301,QSA]

So there is a reason for that in T95164, maybe.

This comment was removed by Dvorapa.

Some projects also return 403 Forbidden, but others redirect to /. How could we achieve the redirect instead of 403?

I thought this is because of this, but maybe i'm wrong:

./puppet/modules/contint/templates/apache/doc.wikimedia.org.erb

# T95164
DirectorySlash Off
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ https://doc.wikimedia.org/$1/ [R=301,QSA]

So there is a reason for that in T95164, maybe.

Not sure about the reason, but what could we do here otherwise?

Here's my hunch...we automatically redirect if there is only one directory in the folder:

legoktm@contint1001:/srv/org/wikimedia/doc$ ls oojs
master

In comparison:

legoktm@contint1001:/srv/org/wikimedia/doc$ ls pywikibot/
api_ref		   index.html	       _modules		 search.html
credits.html	   installation.html   objects.inv	 searchindex.js
genindex.html	   library_usage.html  py-modindex.html  _sources
getting_help.html  licenses.html       scripts		 _static

So I think we should switch to pywikibot/master/[...], and then if it's wanted, we could also publish documentation for published versions (git tags).

Change 439454 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[integration/config@master] Publish pywikibot docs to /$DOC_SUBPATH

https://gerrit.wikimedia.org/r/439454

Change 439456 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[integration/docroot@master] doc: Point to pywikibot/master/

https://gerrit.wikimedia.org/r/439456

Change 439454 merged by jenkins-bot:
[integration/config@master] Publish pywikibot docs to /$DOC_SUBPATH

https://gerrit.wikimedia.org/r/439454

Change 439456 merged by jenkins-bot:
[integration/docroot@master] doc: Point to pywikibot/master/

https://gerrit.wikimedia.org/r/439456

OK, so there's still a bit of Varnish caching involved (will expire in 30 minutes), but this should work as expected now:

curl -sI "https://doc.wikimedia.org/pywikibot" | grep -P "location|HTTP"
HTTP/2 301 
location: pywikibot/
curl -sI "https://doc.wikimedia.org/pywikibot/?1" | grep -P "location|HTTP"
HTTP/2 302 
location: ./master/

(second one has a query parameter to bypass varnish cache)

The canonical URL is now https://doc.wikimedia.org/pywikibot/master/. @Dvorapa does everything look good to you?

oh nice, thanks for fixing it this way :)

Dvorapa closed this task as Resolved.EditedJun 10 2018, 1:13 PM
Dvorapa assigned this task to Legoktm.

I was not the author of this task, I just work on a goal to lower Pyiwkibot tasks from 1000 to 900 till December, 31 :) You fixed the original problem, hopefully the auto-generated docs are working as before, I'm happy to close this one as solved, thank you :)

Buut, wait. What if someone goes to https://doc.wikimedia.org/pywikibot/master? The same problem here. I'm not sure now