comp.lang.ada
 help / color / mirror / Atom feed
* AWS combined dispatcher Virtual host and URI
@ 2020-04-19 14:50 Per Jakobsen
  2020-04-19 15:25 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 13+ messages in thread
From: Per Jakobsen @ 2020-04-19 14:50 UTC (permalink / raw)


I'm working on an AWS server that may be deployed to handle multiple Virtual hosts each with different root URIs.

For instance a media gallery may be deployed on "http://personal_domain/<user>/gallery" but I may also like to use the same gallery server for "http://company_domain/gallery", both running on the same physical server.

Am I right that AWS currently has no predefined dispatchers to handle this situation?

Anyone made a "patented" solution for this? Otherwise I think I will give it a try...

~Per

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: AWS combined dispatcher Virtual host and URI
  2020-04-19 14:50 AWS combined dispatcher Virtual host and URI Per Jakobsen
@ 2020-04-19 15:25 ` Dmitry A. Kazakov
  2020-04-19 17:54   ` Per Jakobsen
  0 siblings, 1 reply; 13+ messages in thread
From: Dmitry A. Kazakov @ 2020-04-19 15:25 UTC (permalink / raw)


On 2020-04-19 16:50, Per Jakobsen wrote:
> I'm working on an AWS server that may be deployed to handle multiple Virtual hosts each with different root URIs.
> 
> For instance a media gallery may be deployed on "http://personal_domain/<user>/gallery" but I may also like to use the same gallery server for "http://company_domain/gallery", both running on the same physical server.
> 
> Am I right that AWS currently has no predefined dispatchers to handle this situation?

And the problem is? Doesn't it has a callback on GET requests where you 
could process the URI and accumulate/point to the response body?

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: AWS combined dispatcher Virtual host and URI
  2020-04-19 15:25 ` Dmitry A. Kazakov
@ 2020-04-19 17:54   ` Per Jakobsen
  2020-04-19 19:55     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 13+ messages in thread
From: Per Jakobsen @ 2020-04-19 17:54 UTC (permalink / raw)


søndag den 19. april 2020 kl. 17.25.08 UTC+2 skrev Dmitry A. Kazakov:
> > Am I right that AWS currently has no predefined dispatchers to handle this situation?
> 
> And the problem is? Doesn't it has a callback on GET requests where you 
> could process the URI and accumulate/point to the response body?

It's not really a problem. More a wonder if I missed something obvious.
Wouldn't it be more logical to make a Virtual Host dispatcher that will also select on URI(-prefix)?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: AWS combined dispatcher Virtual host and URI
  2020-04-19 17:54   ` Per Jakobsen
@ 2020-04-19 19:55     ` Dmitry A. Kazakov
  2020-04-20  9:08       ` Per Jakobsen
  0 siblings, 1 reply; 13+ messages in thread
From: Dmitry A. Kazakov @ 2020-04-19 19:55 UTC (permalink / raw)


On 2020-04-19 19:54, Per Jakobsen wrote:
> søndag den 19. april 2020 kl. 17.25.08 UTC+2 skrev Dmitry A. Kazakov:
>>> Am I right that AWS currently has no predefined dispatchers to handle this situation?
>>
>> And the problem is? Doesn't it has a callback on GET requests where you
>> could process the URI and accumulate/point to the response body?
> 
> It's not really a problem. More a wonder if I missed something obvious.
> Wouldn't it be more logical to make a Virtual Host dispatcher that will also select on URI(-prefix)?

Then I really do not understand the problem. It is a plain map path -> 
content. You can have as many aliases you want.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: AWS combined dispatcher Virtual host and URI
  2020-04-19 19:55     ` Dmitry A. Kazakov
@ 2020-04-20  9:08       ` Per Jakobsen
  2020-04-20 11:25         ` Dmitry A. Kazakov
  0 siblings, 1 reply; 13+ messages in thread
From: Per Jakobsen @ 2020-04-20  9:08 UTC (permalink / raw)


søndag den 19. april 2020 kl. 21.55.42 UTC+2 skrev Dmitry A. Kazakov:
> > Wouldn't it be more logical to make a Virtual Host dispatcher that will also select on URI(-prefix)?
> 
> Then I really do not understand the problem. It is a plain map path -> 
> content. You can have as many aliases you want.

I don't want to see Virtual hosts as aliases, but as distinct different hosts: "http://personal_domain/gallery" and "http://company_domain/gallery" should serve two different galleries.

~Per

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: AWS combined dispatcher Virtual host and URI
  2020-04-20  9:08       ` Per Jakobsen
@ 2020-04-20 11:25         ` Dmitry A. Kazakov
  2020-04-20 13:20           ` J-P. Rosen
  0 siblings, 1 reply; 13+ messages in thread
From: Dmitry A. Kazakov @ 2020-04-20 11:25 UTC (permalink / raw)


On 2020-04-20 11:08, Per Jakobsen wrote:
> søndag den 19. april 2020 kl. 21.55.42 UTC+2 skrev Dmitry A. Kazakov:
>>> Wouldn't it be more logical to make a Virtual Host dispatcher that will also select on URI(-prefix)?
>>
>> Then I really do not understand the problem. It is a plain map path ->
>> content. You can have as many aliases you want.
> 
> I don't want to see Virtual hosts as aliases, but as distinct different hosts: "http://personal_domain/gallery" and "http://company_domain/gallery" should serve two different galleries.

You mean you want to add the domain name to the map's key "gallery" in 
order to distinguish different contents? How this is supposed to work if 
both domain names are resolved to the same IP address and the client 
uses the address?

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: AWS combined dispatcher Virtual host and URI
  2020-04-20 11:25         ` Dmitry A. Kazakov
@ 2020-04-20 13:20           ` J-P. Rosen
  2020-04-20 14:46             ` Dmitry A. Kazakov
  0 siblings, 1 reply; 13+ messages in thread
From: J-P. Rosen @ 2020-04-20 13:20 UTC (permalink / raw)


Le 20/04/2020 à 13:25, Dmitry A. Kazakov a écrit :
>> I don't want to see Virtual hosts as aliases, but as distinct
>> different hosts: "http://personal_domain/gallery" and
>> "http://company_domain/gallery" should serve two different galleries.
> 
> You mean you want to add the domain name to the map's key "gallery" in
> order to distinguish different contents? How this is supposed to work if
> both domain names are resolved to the same IP address and the client
> uses the address?

I've done that for a long time. If you query, you'll see that adalog.fr,
www.adalog.fr, adenothe.org all refer to the same IP address...

I have a real root directory (configured in the server config file),
with subdirectories named like the root URL of each virtual host. Here
is how I compute the root directory for each virtual host:

 Hostname  : constant String  := Status.Host (Request);
 K         : constant Natural := Index (Hostname, ":", Backward);
 Host_Root : constant String  := WWW_Root
                                  (Server.Config
                                   (Server.Get_Current.all))
                                     & (if K = 0
                                        then Hostname
                                        else Hostname (1 .. K-1));

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: AWS combined dispatcher Virtual host and URI
  2020-04-20 13:20           ` J-P. Rosen
@ 2020-04-20 14:46             ` Dmitry A. Kazakov
  2020-04-20 16:09               ` J-P. Rosen
  2020-04-21 21:25               ` Randy Brukardt
  0 siblings, 2 replies; 13+ messages in thread
From: Dmitry A. Kazakov @ 2020-04-20 14:46 UTC (permalink / raw)


On 2020-04-20 15:20, J-P. Rosen wrote:
> Le 20/04/2020 à 13:25, Dmitry A. Kazakov a écrit :
>>> I don't want to see Virtual hosts as aliases, but as distinct
>>> different hosts: "http://personal_domain/gallery" and
>>> "http://company_domain/gallery" should serve two different galleries.
>>
>> You mean you want to add the domain name to the map's key "gallery" in
>> order to distinguish different contents? How this is supposed to work if
>> both domain names are resolved to the same IP address and the client
>> uses the address?
> 
> I've done that for a long time. If you query, you'll see that adalog.fr,
> www.adalog.fr, adenothe.org all refer to the same IP address...
> 
> I have a real root directory (configured in the server config file),
> with subdirectories named like the root URL of each virtual host. Here
> is how I compute the root directory for each virtual host:
> 
>   Hostname  : constant String  := Status.Host (Request);
>   K         : constant Natural := Index (Hostname, ":", Backward);
>   Host_Root : constant String  := WWW_Root
>                                    (Server.Config
>                                     (Server.Get_Current.all))
>                                       & (if K = 0
>                                          then Hostname
>                                          else Hostname (1 .. K-1));

You are using the HTTP header "Host", right? But if the URI deploys the 
IP address like:

    http://192.168.1.1/gallery

The host header is meant to serve as an alias, but there is no guarantee 
it would work, only if the client cooperates.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: AWS combined dispatcher Virtual host and URI
  2020-04-20 14:46             ` Dmitry A. Kazakov
@ 2020-04-20 16:09               ` J-P. Rosen
  2020-04-20 19:59                 ` Per Jakobsen
  2020-04-21 21:25               ` Randy Brukardt
  1 sibling, 1 reply; 13+ messages in thread
From: J-P. Rosen @ 2020-04-20 16:09 UTC (permalink / raw)


Le 20/04/2020 à 16:46, Dmitry A. Kazakov a écrit :
> You are using the HTTP header "Host", right? 
Yes, or more exactly, I access it through the AWS provided function

> But if the URI deploys the
> IP address like:
> 
>    http://192.168.1.1/gallery
> 
> The host header is meant to serve as an alias, but there is no guarantee
> it would work, only if the client cooperates.
Virtual hosts are several logical hosts served by the same physical
server. Therefore, by definition, there is no way to distinguish if the
user provides just the IP address.

But this is a red herring. If you give your visitor a URL that works,
and the visitor tries something else and it doesn't work, well... too
bad for him.


-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: AWS combined dispatcher Virtual host and URI
  2020-04-20 16:09               ` J-P. Rosen
@ 2020-04-20 19:59                 ` Per Jakobsen
  2020-04-21  5:39                   ` J-P. Rosen
  0 siblings, 1 reply; 13+ messages in thread
From: Per Jakobsen @ 2020-04-20 19:59 UTC (permalink / raw)


mandag den 20. april 2020 kl. 18.09.02 UTC+2 skrev J-P. Rosen:
> > The host header is meant to serve as an alias, but there is no guarantee
> > it would work, only if the client cooperates.
>
> Virtual hosts are several logical hosts served by the same physical
> server. Therefore, by definition, there is no way to distinguish if the
> user provides just the IP address.
> 
> But this is a red herring. If you give your visitor a URL that works,
> and the visitor tries something else and it doesn't work, well... too
> bad for him.

That was my thought, or if the host header is not given, fall back to one of the other galleries, or even an entirely different one.

~Per

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: AWS combined dispatcher Virtual host and URI
  2020-04-20 19:59                 ` Per Jakobsen
@ 2020-04-21  5:39                   ` J-P. Rosen
  2020-04-21  5:45                     ` Per Jakobsen
  0 siblings, 1 reply; 13+ messages in thread
From: J-P. Rosen @ 2020-04-21  5:39 UTC (permalink / raw)


Le 20/04/2020 à 21:59, Per Jakobsen a écrit :
> mandag den 20. april 2020 kl. 18.09.02 UTC+2 skrev J-P. Rosen:

>> But this is a red herring. If you give your visitor a URL that works,
>> and the visitor tries something else and it doesn't work, well... too
>> bad for him.
> 
> That was my thought, or if the host header is not given, fall back to one of the other galleries, or even an entirely different one.
> 
Or open a nice page asking "which gallery do you want?" ...


-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: AWS combined dispatcher Virtual host and URI
  2020-04-21  5:39                   ` J-P. Rosen
@ 2020-04-21  5:45                     ` Per Jakobsen
  0 siblings, 0 replies; 13+ messages in thread
From: Per Jakobsen @ 2020-04-21  5:45 UTC (permalink / raw)


tirsdag den 21. april 2020 kl. 07.39.19 UTC+2 skrev J-P. Rosen:
> > That was my thought, or if the host header is not given, fall back to one of the other galleries, or even an entirely different one.
> > 
> Or open a nice page asking "which gallery do you want?" ...

That may be tricky, as all images may be fetched on IP-address, but with a session ID I guess that could be solved...

~Per

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: AWS combined dispatcher Virtual host and URI
  2020-04-20 14:46             ` Dmitry A. Kazakov
  2020-04-20 16:09               ` J-P. Rosen
@ 2020-04-21 21:25               ` Randy Brukardt
  1 sibling, 0 replies; 13+ messages in thread
From: Randy Brukardt @ 2020-04-21 21:25 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2174 bytes --]

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:r7kcjg$1543$1@gioia.aioe.org...
> On 2020-04-20 15:20, J-P. Rosen wrote:
>> Le 20/04/2020 à 13:25, Dmitry A. Kazakov a écrit :
>>>> I don't want to see Virtual hosts as aliases, but as distinct
>>>> different hosts: "http://personal_domain/gallery" and
>>>> "http://company_domain/gallery" should serve two different galleries.
>>>
>>> You mean you want to add the domain name to the map's key "gallery" in
>>> order to distinguish different contents? How this is supposed to work if
>>> both domain names are resolved to the same IP address and the client
>>> uses the address?
>>
>> I've done that for a long time. If you query, you'll see that adalog.fr,
>> www.adalog.fr, adenothe.org all refer to the same IP address...
>>
>> I have a real root directory (configured in the server config file),
>> with subdirectories named like the root URL of each virtual host. Here
>> is how I compute the root directory for each virtual host:
>>
>>   Hostname  : constant String  := Status.Host (Request);
>>   K         : constant Natural := Index (Hostname, ":", Backward);
>>   Host_Root : constant String  := WWW_Root
>>                                    (Server.Config
>>                                     (Server.Get_Current.all))
>>                                       & (if K = 0
>>                                          then Hostname
>>                                          else Hostname (1 .. K-1));
>
> You are using the HTTP header "Host", right? But if the URI deploys the IP 
> address like:
>
>    http://192.168.1.1/gallery
>
> The host header is meant to serve as an alias, but there is no guarantee 
> it would work, only if the client cooperates.

I do something similar on the Ada-Server. Bare IP addresses are treated as a 
different host (and essentially point to an empty web site). It might break 
someone's not very well designed tool, but it doesn't matter to any of the 
major browsers or search bots -- and those are the customers, not the SEO 
bots and other criminals that may visit. (SEO bots often use IP-only 
addresses.)

                                 Randy. 


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-04-21 21:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19 14:50 AWS combined dispatcher Virtual host and URI Per Jakobsen
2020-04-19 15:25 ` Dmitry A. Kazakov
2020-04-19 17:54   ` Per Jakobsen
2020-04-19 19:55     ` Dmitry A. Kazakov
2020-04-20  9:08       ` Per Jakobsen
2020-04-20 11:25         ` Dmitry A. Kazakov
2020-04-20 13:20           ` J-P. Rosen
2020-04-20 14:46             ` Dmitry A. Kazakov
2020-04-20 16:09               ` J-P. Rosen
2020-04-20 19:59                 ` Per Jakobsen
2020-04-21  5:39                   ` J-P. Rosen
2020-04-21  5:45                     ` Per Jakobsen
2020-04-21 21:25               ` Randy Brukardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox