| Author |
Message |
< Yaws mailing list ~ virtual server with multiple names |
| Guest |
Posted: Sun Nov 05, 2006 2:09 am |
|
|
|
Guest
|
Greetings,
I'm trying to add a virtual server which has more than one name.
Typically, I want the server to answer to both domain.dom as well as
WWW.domain.dom, and in rare cases, a third or more names as well.
In Apache, one does this with ServerName and ServerAlias, e.g,
<VirtualHost *:80>
ServerName domain.dom
ServerAlias www.domain.dom
</VirtualHost>
Now requests for both those hostnames will be handled by this
VirtualHost directive. What's the equivalent for yaws? I found
'servername' in the docs, but that just seems to override <server
ServerName> rather than extending it.
<server domain.dom>
port = 80
listen = 0.0.0.0
servername = www.domain.dom
</server>
I also tried giving servername a comma separated list, but it didn't like that.
--
Cheers, L |
|
|
| Back to top |
|
| noss |
Posted: Sun Nov 05, 2006 3:08 am |
|
|
|
User
Joined: 09 Oct 2005
Posts: 290
|
You might want to redirect one of the domains to the other instead of
having multiples name for the same site.
On 11/5/06, Count László de Almásy <calmasy@gmail.com> wrote:
> Greetings,
>
> I'm trying to add a virtual server which has more than one name.
> Typically, I want the server to answer to both domain.dom as well as
> WWW.domain.dom, and in rare cases, a third or more names as well.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Sun Nov 05, 2006 4:23 am |
|
|
|
Guest
|
I guess that will work. Thanks. Though I wouldn't complain if the
developers added a 'serveralias' directive.
On 11/4/06, Christian S <chsu79@gmail.com> wrote:
> You might want to redirect one of the domains to the other instead of
> having multiples name for the same site.
>
> On 11/5/06, Count L |
|
|
| Back to top |
|
| noss |
Posted: Sun Nov 05, 2006 5:01 pm |
|
|
|
User
Joined: 09 Oct 2005
Posts: 290
|
From my guest appearance in the search engine optimization field I know that
having more than one name for the same document is a bad idea.
Inbound links are not focused to one name of the document, and search engines
can suspect duplicate content and deem the document content less relevant.
On 11/5/06, Count László de Almásy <calmasy@gmail.com> wrote:
> I guess that will work. Thanks. Though I wouldn't complain if the
> developers added a 'serveralias' directive.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Sun Nov 05, 2006 9:08 pm |
|
|
|
Guest
|
Christian S wrote:
> You might want to redirect one of the domains to the other instead of
> having multiples name for the same site.
I agree, using it with redirs is better. This is what I've been
doing for that precise problem with multiple names for the same
domain.
Also noteable here is the configuration directive:
pick_first_virthost_on_nomatch (read in the manpage what it does)
/klacke
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Mon Nov 06, 2006 11:52 am |
|
|
|
Guest
|
Claes Wikstrom-2 wrote:
>
> Christian S wrote:
>> You might want to redirect one of the domains to the other instead of
>> having multiples name for the same site.
>
> I agree, using it with redirs is better. This is what I've been
> doing for that precise problem with multiple names for the same
> domain.
>
> Also noteable here is the configuration directive:
>
> pick_first_virthost_on_nomatch (read in the manpage what it does)
>
> /klacke
>
Adding vhost alias support is pretty trivial.. heres a quick patch that does
it and includes *.servername.com support
to use it add a serveraliases line in your <server> section specifiying one
or more aliases... eg:
<server servername.com>
serveraliases = *.servername.com
port = 80
docroot = www/
</server>
Index: src/yaws.erl
===================================================================
RCS file: /cvsroot/erlyaws/yaws/src/yaws.erl,v
retrieving revision 1.105
diff -u -r1.105 yaws.erl
--- src/yaws.erl 5 Nov 2006 21:20:28 -0000 1.105
+++ src/yaws.erl 6 Nov 2006 11:39:33 -0000
@@ -128,6 +128,8 @@
D#sconf.listen),
servername = lkup(servername, SL,
D#sconf.servername),
+ serveraliases = lkup(serveraliases, SL,
+ D#sconf.serveraliases),
ets = lkup(ets, SL,
D#sconf.ets),
ssl = lkup(ssl, SL,
Index: src/yaws_config.erl
===================================================================
RCS file: /cvsroot/erlyaws/yaws/src/yaws_config.erl,v
retrieving revision 1.108
diff -u -r1.108 yaws_config.erl
--- src/yaws_config.erl 18 Oct 2006 13:51:34 -0000 1.108
+++ src/yaws_config.erl 6 Nov 2006 11:39:34 -0000
@@ -626,6 +626,10 @@
C2 = ?sc_set_add_port((C#sconf{servername = Name}),false),
fload(FD, server, GC, C2, Cs, Lno+1, Next);
+ ["serveraliases", '=', Name] ->
+ C2 = C#sconf{serveraliases = string:tokens(Name, " ")},
+ fload(FD, server, GC, C2, Cs, Lno+1, Next);
+
["docroot", '=', Rootdir | XtraDirs] ->
RootDirs = lists:map(
fun(R) -> filename:absname(R)
Index: src/yaws_server.erl
===================================================================
RCS file: /cvsroot/erlyaws/yaws/src/yaws_server.erl,v
retrieving revision 1.311
diff -u -r1.311 yaws_server.erl
--- src/yaws_server.erl 18 Oct 2006 14:18:46 -0000 1.311
+++ src/yaws_server.erl 6 Nov 2006 11:39:36 -0000
@@ -936,17 +936,29 @@
%% compare servername and ignore any optional
%% :Port postfix
-comp_sname([$ _], _) -> true;
-comp_sname(_, [$ _]) -> true;
-comp_sname([H|T], [H|T1]) -> comp_sname(T,T1);
-comp_sname([],[])-> true;
-comp_sname(_,_)-> false.
+
+comp_sname(H, S, A) ->
+ case comp_sname(H, S) of
+ true -> true;
+ false -> comp_aliases(H, A)
+ end.
+comp_sname(H, [$*, $.|S]) -> lists:suffix(remove_port(S), remove_port(H));
+comp_sname(H, S) -> remove_port(H) == remove_port(S).
+
+remove_port(S) -> hd(string:tokens(S, ":")).
+
+comp_aliases(_, []) -> false;
+comp_aliases(Host, [H|T]) ->
+ case comp_sname(Host, H) of
+ true -> true;
+ false -> comp_aliases(Host, T)
+ end.
pick_sconf(GC, H, [SC|_Group], ssl) ->
- case comp_sname(H#headers.host, SC#sconf.servername) of
+ case comp_sname(H#headers.host, SC#sconf.servername,
SC#sconf.serveraliases) of
true ->
SC;
false when ?gc_pick_first_virthost_on_nomatch(GC) ->
@@ -968,7 +980,7 @@
pick_host(GC, Host, [SC|T], Group) ->
- case comp_sname(Host, SC#sconf.servername) of
+ case comp_sname(Host, SC#sconf.servername, SC#sconf.serveraliases) of
true -> SC;
false -> pick_host(GC, Host, T, Group)
end;
Index: include/yaws.hrl
===================================================================
RCS file: /cvsroot/erlyaws/yaws/include/yaws.hrl,v
retrieving revision 1.58
diff -u -r1.58 yaws.hrl
--- include/yaws.hrl 18 Oct 2006 13:51:34 -0000 1.58
+++ include/yaws.hrl 6 Nov 2006 11:39:37 -0000
@@ -174,7 +174,8 @@
opaque = [], %% useful in embedded mode
start_mod, %% user provided module to be started
allowed_scripts = [yaws],
- revproxy = []
+ revproxy = [],
+ serveraliases = []
}).
%% we cannot compare sconfs directly due to the ets
--
View this message in context: http://www.nabble.com/virtual-server-with-multiple-names-tf2576005.html#a7197302
Sent from the Yaws mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|