tunapanda / provision

System for provisioning a new virtual machine with Tunapanda Edubuntu
7 stars 12 forks source link

Transparently redirect wikipedia URLs to the corresponding wikipedia for schools URL, if present #33

Open usernamenumber opened 9 years ago

usernamenumber commented 9 years ago

The wikipedia role is written for Apache, but the current system uses nginx. Role needs to be "ported" to deploy to nginx instead.

devalih commented 9 years ago

Nginx community has a good template to start with http://wiki.nginx.org/MediaWiki

Ar2000jp commented 9 years ago

@devalih That link is for MediaWiki, not WfS. WfS seems to be static only. The apache config uses RewriteRule & CheckSpelling to translate from Wikipedia URLs to WfS. This is useful for making use of Wikipedia's search engine, I think. From my research, NGINX doesn't have an equivalent for the spelling module. 2 alternatives come to mind: 1- Serve WfS static, without Wikipedia -> WfS redirection. 2- Write some CGI to handle the spelling rewrite.

usernamenumber commented 9 years ago

Hi guys, just checking in real quick from a WiFi cafe (probably my only time online until Sunday). IIRC, mod_speling is only used for case issues, like making '/Chemistry' match '/chemistry' (or maybe it's the other way around?). There's probably a way to use a case-insensitive regex in nginx that just writes both to the correct values. I'd suggest researching that.

And Ahmad, it was great to check my email and see so much activity from you! I look forward to revising as much of it as I can before I have to leave the cafe. Great work! On Feb 3, 2015 5:04 AM, "Ahmad Draidi" notifications@github.com wrote:

@devalih https://github.com/devalih That link is for MediaWiki, not WfS. WfS seems to be static only. The apache config uses RewriteRule & CheckSpelling to translate from Wikipedia URLs to WfS. This is useful for making use of Wikipedia's search engine, I think. From my research, NGINX doesn't have an equivalent for the spelling module. 2 alternatives come to mind: 1- Serve WfS static, without Wikipedia -> WfS redirection. 2- Write some CGI to handle the spelling rewrite.

— Reply to this email directly or view it on GitHub https://github.com/tunapanda/provision/issues/33#issuecomment-72615997.

Ar2000jp commented 9 years ago

RegEx is used for matching only, AFAIK. It can't be used to change the matched variables. The problem is getting the URI to match the files on disk. After some research, there seems to be no way for NGINX to load files in a case-insensitive way, except for external modules. I found this: https://github.com/replay/ngx_http_lower_upper_case , but I think it's a bad idea to use an external module. A small CGI script would be easier to maintain.

PS: Thank you. :)

usernamenumber commented 9 years ago

This is at least fixed for now by integration of the RACHEL module for Wikipedia for Schools. However, eventually we want some automation that translates wikipedia URLs into the corresponding WfS URL.

For now, though, the minimum we need is sorted out once #48 is resolved and RACHEL support can be merged in.

usernamenumber commented 9 years ago

Updated the title to reflect the current goal of this issue. Removed from the initial release milestone.

usernamenumber commented 9 years ago

Relevant comment about kili.io's configuration, which does something like what we want: https://github.com/tunapanda/provision/issues/20#issuecomment-71381339