0

I'm having a problem with my vhosts using regex. When I use the following code, I get a 404 not found:

$HTTP["host"] =~ "(^|\.)example\.com$" {
...
}

However, when I explicitly set it to the following, I can get to my site:

$HTTP["host"] == "example.com" {
...
}

Does anyone know why this is happening? The documentation is fairly sparse.

Mike
  • 141
  • 3

2 Answers2

1

I think I've found my problem. I'm using port 8080 instead of port 80 and I read the somewhat hidden text on the very bottom of the documentation page that states:

(Doesn't work for you? If you're not running on the default port, $HTTP["host"] will have the port number appended and the above reg-ex won't match it, since the trailing "$" means "the-string-ends-this-way".)

Mike
  • 141
  • 3
1

You already found the problem; now fix it by using ($|:) or (:[0-9]+)?$ instead of $.

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
Stefan
  • 819
  • 1
  • 7
  • 18