Page MenuHomePhabricator

Custom mod_alias config not allowed for tools due to default lighttpd configuration
Open, LowPublic

Description

aliases config for a tool doesn't seem to be working as expected

My config lighttpd.conf
alias.url += ("/api" => "/data/project/interaction-timeline/tool/server/src/public")

on the logs

2018-01-30 18:20:29: (response.c.545) Doc-Root     : /data/project/interaction-timeline/public_html
2018-01-30 18:20:29: (response.c.546) Basedir      : /data/project/interaction-timeline/public_html/
2018-01-30 18:20:29: (response.c.547) Rel-Path     : /interaction-timeline/api/hello
2018-01-30 18:20:29: (response.c.548) Path         : /data/project/interaction-timeline/public_html//api/hello
2018-01-30 18:20:29: (response.c.565) -- handling physical path
2018-01-30 18:20:29: (response.c.566) Path         : /data/project/interaction-timeline/public_html//api/hello
2018-01-30 18:20:29: (response.c.624) -- file not found
2018-01-30 18:20:29: (response.c.625) Path         : /data/project/interaction-timeline/public_html//api/hello

The same config is applied to a container using phpdocker-registry.tools.wmflabs.org/toollabs-php-web image and it works just fine

Event Timeline

Should the alias also include the toolname? e.g.

alias.url += ("/interaction-timeline/api" => "/data/project/interaction-timeline/tool/server/src/public")

I tried that as the docs were prescribing it in that format but this was happening

2018-01-30 08:01:24: (mod_alias.c.106) url.alias: `/interaction-timeline/' will never match as `/interaction-timeline' matched first
2018-01-30 08:01:24: (server.c.1022) Configuration of plugins failed. Going down.

which makes sense because the default config on toolforge includes this
alias.url = ( "/{toolname}" => "{home}/public_html/" )

This might not be a bug at all and it is me not knowing how to set it up. But it works with the same image in a local container and not on toolforge

I seem to have confused things here. Seeing the full lighttpd.conf it seems clear that it is not possible to add an alias (lighttpd will complain about the same prefix, or set it directly without the toolname prefix). Symbolic links or rewrites will have to be used to achieve this result.

Priority low, all I see that is left is to change docs to reflect actual lighttpd behaviour.

Pardon my ignorance but why do we need alias.url = ( "/{toolname}" => "{home}/public_html/" ) as part of the default config? Shouldn't it just work without it considering that the document root is pointing to the same directory?

Pardon my ignorance but why do we need alias.url = ( "/{toolname}" => "{home}/public_html/" ) as part of the default config? Shouldn't it just work without it considering that the document root is pointing to the same directory?

The document root does point at that directory, but the public URL space is https://tools.wmflabs.org/$TOOLNAME. The lighttpd instance that is running for a given tool sees URLs with the $TOOLNAME prefix and would otherwise not know how to route them. It's gross and someday we will fix it with T125589: Allow each tool to have its own subdomain for browser sandbox/cookie isolation so that the public URL space is something like https://$TOOLNAME.toolforge.org instead.

bd808 renamed this task from mod_alias config for toolforge doesn't seem to be working to Custom mod_alias config not allowed for tools due to default lighttpd configuration.Mar 11 2018, 12:51 AM
bd808 edited projects, added Toolforge; removed cloud-services-team.