SERVER_NAME cgi variable

Denys Vlasenko vda.linux at googlemail.com
Mon Jul 6 11:11:20 UTC 2009


On Monday 06 July 2009 10:27, Anna Martynova wrote:
> Hello.
> I saw comments in the source, that you recommend to set SERVER_NAME variable
> before starting httpd server. But what to do in the case, when server has
> several addresses and I need to know, what address the client have
> requested?
> For example, Apache web server provides this, variable SERVER_NAME is
> request-specific.

http://www.zytrax.com/tech/web/env_var.htm:

"SERVER_NAME

The servers host name, DNS alias or IP address. For Apache
the name appearing on the relevant ServerName directive
(may be in the general section or a <virtualhost> section e.g."

busybox httpd does not support virtual hosts.
You need to implement this support in the CGI itself.

> I understand, that busybox httpd is not Apache. :) But 
> could you give some hint, how to get it?

HTTP_HOST is the variable you are looking for.
It is retrieved from "Host:" header.

--
vda


More information about the busybox mailing list