Bug #1653

mod_alias silently drops aliases containing a ~

Added by Anonymous over 12 years ago. Updated almost 12 years ago.

Missing Feedback
Target version:


In my configuration, I want to map a location to a script. The following would accomplish this:

alias.url = ("/~dave/logs/search" => "/home/dave/bot/logs/")

However, this does not work: A request for /~dave/logs/search 404s. Changing the above to:

alias.url = ("/dave/logs/search" => "/home/dave/bot/logs/")

results in the alias working perfectly.

For the purposes of this little exercise, mod_userdir was disabled. My original plan was of course to have this override one path within a userdir-enabled path, but this bug is present even without mod_userdir.

-- dave


Updated by Anonymous over 12 years ago

The following workaround is usable:

url.rewrite = ("^/~dave/logs/search" => "/random_gibberish_url")
alias.url = ("/random_gibberish_url" => "/home/dave/bot/logs/")

Apparently mod_rewrite does not suffer from the same issues, and can rewrite the tilded URL to some internal identifier (I used pwgen -s 42 to generate one). Then, mod_alias successfully maps that internal identifier to a script, and with further configuration mod_cgi can execute it.

-- dave


Updated by stbuehler over 12 years ago

I couldn't reproduce your problem, perhaps you should post a minimal config which reproduces your problem.

I even created a extra testcase to test this, see;h=refs/heads/lighttpd-1.4.x-stbuehler


Updated by stbuehler almost 12 years ago

  • Status changed from New to Fixed
  • Resolution set to worksforme

Missing feedback.


Updated by moo almost 12 years ago

  • Status changed from Fixed to Need Feedback
  • Resolution deleted (worksforme)

i can reproduce this bug when pressing "enter" in firefox address bar, request is sent as "%7e" or "%7E". This issue affects mod_alias/redirect/rewrite as they match on raw url instead of clean url (lighttpd 1.5)


Updated by stbuehler almost 12 years ago

  • Status changed from Need Feedback to Fixed
  • Resolution set to worksforme

And i checked it again...:

server.modules = (

server.document-root = var.cwd + "/default/htdocs" 
server.port                    = 8081

alias.url = ( "/~user1/test.txt" => var.cwd + "/default/htdocs/test.txt" )

There is of course a test.txt in ./default/htdocs/

Now, i can get other files in that directory with http://localhost:8081/otherfile but not with http://localhost:8081/~user1/otherfile (as expected), but http://localhost:8081/~user1/test.txt works, with and without %7e encoding:

$ curl -v http://localhost:8081/%7euser1/test.txt
* About to connect() to localhost port 8081 (#0)
*   Trying connected
* Connected to localhost ( port 8081 (#0)
> GET /%7euser1/test.txt HTTP/1.1
> User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/ libidn/1.8 libssh2/0.18
> Host: localhost:8081
> Accept: */*
< HTTP/1.1 200 OK
< Content-Type: application/octet-stream
< Accept-Ranges: bytes
< Content-Length: 328
< Date: Mon, 22 Sep 2008 09:48:45 GMT
< Server: lighttpd/1.4.19
* Connection #0 to host localhost left intact
* Closing connection #0

For rewrite/redirect see #1720


Updated by stbuehler almost 12 years ago

  • Status changed from Fixed to Missing Feedback

Also available in: Atom