Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 26720 invoked by uid 6000); 13 Nov 1999 10:09:23 -0000 Received: (qmail 26714 invoked from network); 13 Nov 1999 10:09:18 -0000 Received: from chailly.ensmp.fr (root@192.54.172.200) by taz.hyperreal.org with SMTP; 13 Nov 1999 10:09:18 -0000 Received: from blonville.ensmp.fr (blonville.ensmp.fr [192.54.172.192]) by chailly.ensmp.fr (8.8.8/8.8.8/chailly-CRI) with ESMTP id LAA29677 for ; Sat, 13 Nov 1999 11:09:14 +0100 (MET) Received: from localhost (coelho@localhost) by blonville.ensmp.fr (8.9.1/8.9.1/client-solaris2-CRI) with ESMTP id LAA07285 for ; Sat, 13 Nov 1999 11:09:15 +0100 (MET) X-Authentication-Warning: blonville.ensmp.fr: coelho owned process doing -bs Date: Sat, 13 Nov 1999 11:09:14 +0100 (MET) From: Fabien COELHO X-Sender: coelho@blonville To: APACHE development mailing list Subject: patch to force name virtual hosts Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-851401618-942487754=:7244" Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. ---559023410-851401618-942487754=:7244 Content-Type: TEXT/PLAIN; charset=US-ASCII Hello Apache, I wish I could force name virtual hosts on any ip interface of a machine. This is not allowed by apache: only names which resolves to local interfaces are accepted. Thus I've extended the VirtualHost syntax to do it. Why forcing name virtual hosts ? - I want to do this for demonstration purposes in a course about HTTP. - It also helps me with configuring a local gateway, which can handle any site directly, whether or not it resolves to its own IP address. I can do this with rewrites or redirects I guess, but it is simpler to just configure a vhost for the purpose. - It might also help to check and test sites on development machines, with the actual name of the production machine. I've attached a small patch to do it. I tried to respect the apache coding style: In particular, there are as many comments, and I sticked to one-letter variable names;-) The path extends the VirtualHost syntax with: [
/]
[:port]. The old syntax still works the same. The new n1/n2 syntax forces n1 on n2 interface. It looks like: ServerName www.apache.org DocumentRoot /path/to/local/root/of/apache/if/any ... Note that it does not make sense to try to do this in an external module: the patch is really small (20 lines are added or modified), and the core apache directives among which VirtualHost are maintained in main/* files. If the patch is accepted, the documentation should also be updated to reflect the new syntax extension. As my English is not perfect, I think that it is an appropriate job for a native speaker to do it. However I can suggest a patch to the documentation anyway. Have a nice day, -- Fabien Coelho ___ coelho@cri.ensmp.fr ___ http://www.cri.ensmp.fr/~coelho ---559023410-851401618-942487754=:7244 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="vhost.patch" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: patch to extend VirtualHost syntax Content-Disposition: attachment; filename="vhost.patch" LS0tIHNyYy9tYWluL2h0dHBfdmhvc3QuYy5vcmlnCUZyaSBOb3YgMTIgMjA6 NDk6MTcgMTk5OQ0KKysrIHNyYy9tYWluL2h0dHBfdmhvc3QuYwlGcmkgTm92 IDEyIDIwOjU3OjU0IDE5OTkNCkBAIC0xNTgsNyArMTU4LDcgQEANCiANCiAN CiAvKg0KLSAqIFBhcnNlcyBhIGhvc3Qgb2YgdGhlIGZvcm0gPGFkZHJlc3M+ Wzpwb3J0XQ0KKyAqIFBhcnNlcyBhIGhvc3Qgb2YgdGhlIGZvcm0gPGFkZHJl c3M+Wy88aXAtYWRkcmVzcz5dWzpwb3J0XQ0KICAqIHBhZGRyIGlzIHVzZWQg dG8gY3JlYXRlIGEgbGlzdCBpbiB0aGUgb3JkZXIgb2YgaW5wdXQNCiAgKiAq KnBhZGRyIGlzIHRoZSAtPm5leHQgcG9pbnRlciBvZiB0aGUgbGFzdCBlbnRy eSAob3Igcy0+YWRkcnMpDQogICogKnBhZGRyIGlzIHRoZSB2YXJpYWJsZSB1 c2VkIHRvIGtlZXAgdHJhY2sgb2YgKipwYWRkciBiZXR3ZWVuIGNhbGxzDQpA QCAtMTcwLDcgKzE3MCw3IEBADQogICAgIHN0cnVjdCBob3N0ZW50ICpoZXA7 DQogICAgIHVuc2lnbmVkIGxvbmcgbXlfYWRkcjsNCiAgICAgc2VydmVyX2Fk ZHJfcmVjICpzYXI7DQotICAgIGNoYXIgKnQ7DQorICAgIGNoYXIgKnQsICpz Ow0KICAgICBpbnQgaSwgaXNfYW5faXBfYWRkcjsNCiANCiAgICAgaWYgKCp3 ID09IDApDQpAQCAtMTkwLDYgKzE5MCwyNCBAQA0KIAkqdCA9IDA7DQogICAg IH0NCiANCisgICAgLyogPGFkZHJlc3M+LzxpcC1hZGRyZXNzPiBjYXNlOiB0 YWtlIGFkZHJlc3MsIHdoYXRldmVyIGl0IGlzLiAqLw0KKyAgICBzID0gc3Ry Y2hyKHcsICcvJyk7DQorICAgIGlmIChzKSB7DQorICAgICAgICBpZiAoKG15 X2FkZHIgPSBhcF9pbmV0X2FkZHIocysxKSkgPT0gSU5BRERSX05PTkUpIHsN CisJICAgIHJldHVybiAiLzxpcC1hZGRyZXNzPiBleHBlY3RlZCI7DQorCX0N CisJKnMgPSAwOw0KKwlzYXIgPSBhcF9wY2FsbG9jKHAsIHNpemVvZihzZXJ2 ZXJfYWRkcl9yZWMpKTsNCisJKipwYWRkciA9IHNhcjsNCisJKnBhZGRyID0g JnNhci0+bmV4dDsNCisJc2FyLT5ob3N0X2FkZHIuc19hZGRyID0gbXlfYWRk cjsNCisJc2FyLT5ob3N0X3BvcnQgPSBwb3J0Ow0KKwlzYXItPnZpcnRob3N0 ID0gYXBfcHN0cmR1cChwLCB3KTsNCisJaWYgKHQgIT0gTlVMTCkgKnQgPSAn Oic7DQorCWlmIChzICE9IE5VTEwpICpzID0gJy8nOw0KKwlyZXR1cm4gTlVM TDsNCisgICAgfQ0KKwkNCiAgICAgaXNfYW5faXBfYWRkciA9IDA7DQogICAg IGlmIChzdHJjbXAodywgIioiKSA9PSAwKSB7DQogCW15X2FkZHIgPSBodG9u bChJTkFERFJfQU5ZKTsNCg== ---559023410-851401618-942487754=:7244--