whym / whois-gateway

Web-based whois gateway written in Python for lighttpd
BSD 3-Clause "New" or "Revised" License
26 stars 20 forks source link

Migrate to toolforge (and avoid 404 errors) #16

Closed whym closed 3 years ago

whym commented 4 years ago

Tools are expected to migrate to their own subdomains: https://wikitech.wikimedia.org/wiki/News/Toolforge.org and I intend to do this soon.

whym commented 4 years ago

The new URL (https://whois.toolforge.org) seems to be working. I try to redirect old URLs to new URLs, but if something stopped working, please report below.

QEDK commented 4 years ago

This seems to be running on gridengine, migrate this tool to Python 3 and run on Kubernetes? Also https://tools.wmflabs.org/whois/ does not redirect to https://whois.toolforge.org you seem to be running two instances of the tool or serving both sites.

whym commented 4 years ago

Yes, the redirect from https://tools.wmflabs.org/whois/8.8.8.8 works, but https://tools.wmflabs.org/whois/ doesn't.

I thought both are covered by https://github.com/whym/whois-gateway/blob/f7e7e608bc87f0c4f9789ffdf711f08aa62ca7ff/.lighttpd.conf#L10 ... do you know what I'm missing?

QEDK commented 4 years ago

Yes, the redirect from https://tools.wmflabs.org/whois/8.8.8.8 works, but https://tools.wmflabs.org/whois/ doesn't.

I thought both are covered by

https://github.com/whym/whois-gateway/blob/f7e7e608bc87f0c4f9789ffdf711f08aa62ca7ff/.lighttpd.conf#L10

... do you know what I'm missing?

The parsed regex needs to contain something to meet the condition for redirecting. Since the regex is not matching, it will simply skip the redirect condition and move on to the next. Try accessing http://tools.wmflabs.org/whois/gateway.py? and you will see that it gives a 404 because it skips the first redirect condition and hits the second.

whym commented 4 years ago

What I don't understand is that /whois/(.*)$should match against "/whois/" because '*' includes 0 repetition. But apparently it doesn't. (Or it might be in conflict with something else?)

whym commented 4 years ago

On an unrelated note, I added a 404 page with a link to here to help finding possible issues. https://github.com/whym/whois-gateway/commit/257acd88d24693c39526f88300ef27888f1d7899#diff-2c9edf1bc06432b9b752b0d83ffbd405

MarcoAurelioWM commented 4 years ago

Oh sorry, I didn't see this before. I made #17 proposing fixes for two URLs.