Welcome Guest, Not a member yet? Register   Sign In
Underscores in apache virtual host names
#1

I just wasted an hour trying to figure out why my new server was giving 400 errors. Apparently in this new apache version you cant have underscores in the virtual host names:

https://bugs.debian.org/cgi-bin/bugrepor...bug=851357
Reply
#2

I have always used dashes in my vhost names.

I only use underscores in filenames.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(12-17-2017, 05:05 AM)InsiteFX Wrote: I have always used dashes in my vhost names.

I only use underscores in filenames.

This is just a dev machine. For Community Auth I had been using localhost.community_auth_ci_3. I've been using underscores for years, and then all the sudden they're not allowed. The worst part was that Apache's error message was vague, and I initially thought I had a typo in the vhost file.
Reply
#4

Dashes != underscores. Dashes are perfectly fine (as long as the name doesn't start or end with them).

Underscores have never been a valid character in hostnames. Apache may've allowed them, but I'd guess it just didn't bother checking for them as opposed to explicitly allowing them.

It's a good thing that it finally starts erroring for this, because you now have to fix it from the very start instead of it biting you in the ass at some point later. I've seen way too many people wondering why their sessions don't work, and it turns out they simply can't because the domain name itself is invalid.

Incidentally, that is also where that popular myth about underscores in cookie names under IE comes from - asked MS support why their cookies don't work, they figured out the user put an underscore in their test hostname - problem solved, but then some other idiot misread that and started telling people that you can't have underscores in cookie names instead of domain names. Big Grin
Reply
#5

(12-20-2017, 08:29 AM)Narf Wrote: ...

It's a good thing that it finally starts erroring for this, because you now have to fix it from the very start instead of it biting you in the ass at some point later. I've seen way too many people wondering why their sessions don't work, and it turns out they simply can't because the domain name itself is invalid.

Incidentally, that is also where that popular myth about underscores in cookie names under IE comes from - asked MS support why their cookies don't work, they figured out the user put an underscore in their test hostname - problem solved, but then some other idiot misread that and started telling people that you can't have underscores in cookie names instead of domain names. Big Grin

That's very interesting. I never really thought about it before. I too heard the myth and believed it. If it's on the internet, it has to be true Big Grin
Reply




Theme © iAndrew 2016 - Forum software by © MyBB