[resend] Virtual Hostnames in Jetty?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[resend] Virtual Hostnames in Jetty?

Arsalan Zaidi
Hi.

Here's what I want to do:

The web app (someapp.com) being made allows the creation of new users,
each of which is given an inidividual name e.g.
http://1234.someapp.com. The users can create a more suitable name
like http://someuser.someapp.com which maps to
http://1234.someapp.com, as well.

How do I support functionality like this in Jetty? All users
eventually go to the same set of servlets. The different host names is
simply for convenience.

Regards.

--Arsalan Zaidi


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: [resend] Virtual Hostnames in Jetty?

Greg Wilkins-5
Arsalan,

Firstly you need to make sure that all names like something.someapp.com
resolve to the DNS of your machine.

Now, you could use virtual hosts and create them on the fly, but I
don't think that is what you want.   If you have 1000 users then you
will need 1000 different webapplications - with no shared code etc!

I would simply write a filter that gets the hostname of the request
and either redirects the request according to the extracted username or
simply adds an appropriate user object to the request attributes for
handling downstream.

cheers


Arsalan Zaidi wrote:

> Hi.
>
> Here's what I want to do:
>
> The web app (someapp.com) being made allows the creation of new users,
> each of which is given an inidividual name e.g.
> http://1234.someapp.com. The users can create a more suitable name
> like http://someuser.someapp.com which maps to
> http://1234.someapp.com, as well.
>
> How do I support functionality like this in Jetty? All users
> eventually go to the same set of servlets. The different host names is
> simply for convenience.
>
> Regards.
>
> --Arsalan Zaidi
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Re: [resend] Virtual Hostnames in Jetty?

Arsalan Zaidi
On 8/14/05, Greg Wilkins <[hidden email]> wrote:

> Arsalan,
>
> Firstly you need to make sure that all names like something.someapp.com
> resolve to the DNS of your machine.
>
> Now, you could use virtual hosts and create them on the fly, but I
> don't think that is what you want.   If you have 1000 users then you
> will need 1000 different webapplications - with no shared code etc!
>
> I would simply write a filter that gets the hostname of the request
> and either redirects the request according to the extracted username or
> simply adds an appropriate user object to the request attributes for
> handling downstream.

Yup, that's exactly what I want to do...

Let me explain in greater detail.

1. User goes to http://1234.someapp.com. [forget how that's resolved for now]
2. The security filter checks to see if he has an open session and if
his session is valid for this id (1234). If it's all ok, proceed
3. If there's no valid session or there is a mismatch between the id
stored in the session and the one being visited, send the user to the
login page.

The url is only used while logging in to see what the id is. After
that its stored in the session. It's for branding only, really.  I
could implement this as http://www.someapp.com/1234 and have it much
easier, but that url not as 'user-freindly'. :-P

The code needs to catch all attempts to access http://*.someapp.com
and send them to the *same* webapp; not different ones.

How do I do that?

TIA

--Arsalan

> cheers
>
>
> Arsalan Zaidi wrote:
> > Hi.
> >
> > Here's what I want to do:
> >
> > The web app (someapp.com) being made allows the creation of new users,
> > each of which is given an inidividual name e.g.
> > http://1234.someapp.com. The users can create a more suitable name
> > like http://someuser.someapp.com which maps to
> > http://1234.someapp.com, as well.
> >
> > How do I support functionality like this in Jetty? All users
> > eventually go to the same set of servlets. The different host names is
> > simply for convenience.
> >
> > Regards.
> >
> > --Arsalan Zaidi
> >
> >
> > -------------------------------------------------------
> > SF.Net email is Sponsored by the Better Software Conference & EXPO
> > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> > _______________________________________________
> > Jetty-support mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/jetty-support
> >
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: [resend] Virtual Hostnames in Jetty?

Greg Wilkins-5
Arsalan Zaidi wrote:

> On 8/14/05, Greg Wilkins <[hidden email]> wrote:
>
>>Arsalan,
>>
>>Firstly you need to make sure that all names like something.someapp.com
>>resolve to the DNS of your machine.
>>
>>Now, you could use virtual hosts and create them on the fly, but I
>>don't think that is what you want.   If you have 1000 users then you
>>will need 1000 different webapplications - with no shared code etc!
>>
>>I would simply write a filter that gets the hostname of the request
>>and either redirects the request according to the extracted username or
>>simply adds an appropriate user object to the request attributes for
>>handling downstream.
>
>
> Yup, that's exactly what I want to do...
>
> Let me explain in greater detail.
>
> 1. User goes to http://1234.someapp.com. [forget how that's resolved for now]
> 2. The security filter checks to see if he has an open session and if
> his session is valid for this id (1234). If it's all ok, proceed
> 3. If there's no valid session or there is a mismatch between the id
> stored in the session and the one being visited, send the user to the
> login page.
>
> The url is only used while logging in to see what the id is. After
> that its stored in the session. It's for branding only, really.  I
> could implement this as http://www.someapp.com/1234 and have it much
> easier, but that url not as 'user-freindly'. :-P
>
> The code needs to catch all attempts to access http://*.someapp.com
> and send them to the *same* webapp; not different ones.
>
> How do I do that?


You don't do anything special.  If DNS routes the request to your machine
and the web app does not specify any virtual hosts, then it will receive the
request (if the context path matches)

regards






> TIA
>
> --Arsalan
>
>
>>cheers
>>
>>
>>Arsalan Zaidi wrote:
>>
>>>Hi.
>>>
>>>Here's what I want to do:
>>>
>>>The web app (someapp.com) being made allows the creation of new users,
>>>each of which is given an inidividual name e.g.
>>>http://1234.someapp.com. The users can create a more suitable name
>>>like http://someuser.someapp.com which maps to
>>>http://1234.someapp.com, as well.
>>>
>>>How do I support functionality like this in Jetty? All users
>>>eventually go to the same set of servlets. The different host names is
>>>simply for convenience.
>>>
>>>Regards.
>>>
>>>--Arsalan Zaidi
>>>
>>>
>>>-------------------------------------------------------
>>>SF.Net email is Sponsored by the Better Software Conference & EXPO
>>>September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
>>>Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
>>>Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
>>>_______________________________________________
>>>Jetty-support mailing list
>>>[hidden email]
>>>https://lists.sourceforge.net/lists/listinfo/jetty-support
>>>
>>
>>
>>
>>-------------------------------------------------------
>>SF.Net email is Sponsored by the Better Software Conference & EXPO
>>September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
>>Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
>>Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
>>_______________________________________________
>>Jetty-support mailing list
>>[hidden email]
>>https://lists.sourceforge.net/lists/listinfo/jetty-support
>>
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Re: [resend] Virtual Hostnames in Jetty?

Arsalan Zaidi
OK got that. Thanks!


On 8/16/05, Greg Wilkins <[hidden email]> wrote:

> Arsalan Zaidi wrote:
> > On 8/14/05, Greg Wilkins <[hidden email]> wrote:
> >
> >>Arsalan,
> >>
> >>Firstly you need to make sure that all names like something.someapp.com
> >>resolve to the DNS of your machine.
> >>
> >>Now, you could use virtual hosts and create them on the fly, but I
> >>don't think that is what you want.   If you have 1000 users then you
> >>will need 1000 different webapplications - with no shared code etc!
> >>
> >>I would simply write a filter that gets the hostname of the request
> >>and either redirects the request according to the extracted username or
> >>simply adds an appropriate user object to the request attributes for
> >>handling downstream.
> >
> >
> > Yup, that's exactly what I want to do...
> >
> > Let me explain in greater detail.
> >
> > 1. User goes to http://1234.someapp.com. [forget how that's resolved for now]
> > 2. The security filter checks to see if he has an open session and if
> > his session is valid for this id (1234). If it's all ok, proceed
> > 3. If there's no valid session or there is a mismatch between the id
> > stored in the session and the one being visited, send the user to the
> > login page.
> >
> > The url is only used while logging in to see what the id is. After
> > that its stored in the session. It's for branding only, really.  I
> > could implement this as http://www.someapp.com/1234 and have it much
> > easier, but that url not as 'user-freindly'. :-P
> >
> > The code needs to catch all attempts to access http://*.someapp.com
> > and send them to the *same* webapp; not different ones.
> >
> > How do I do that?
>
>
> You don't do anything special.  If DNS routes the request to your machine
> and the web app does not specify any virtual hosts, then it will receive the
> request (if the context path matches)
>
> regards
>
>
>
>
>
>
> > TIA
> >
> > --Arsalan
> >
> >
> >>cheers
> >>
> >>
> >>Arsalan Zaidi wrote:
> >>
> >>>Hi.
> >>>
> >>>Here's what I want to do:
> >>>
> >>>The web app (someapp.com) being made allows the creation of new users,
> >>>each of which is given an inidividual name e.g.
> >>>http://1234.someapp.com. The users can create a more suitable name
> >>>like http://someuser.someapp.com which maps to
> >>>http://1234.someapp.com, as well.
> >>>
> >>>How do I support functionality like this in Jetty? All users
> >>>eventually go to the same set of servlets. The different host names is
> >>>simply for convenience.
> >>>
> >>>Regards.
> >>>
> >>>--Arsalan Zaidi
> >>>
> >>>
> >>>-------------------------------------------------------
> >>>SF.Net email is Sponsored by the Better Software Conference & EXPO
> >>>September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> >>>Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> >>>Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> >>>_______________________________________________
> >>>Jetty-support mailing list
> >>>[hidden email]
> >>>https://lists.sourceforge.net/lists/listinfo/jetty-support
> >>>
> >>
> >>
> >>
> >>-------------------------------------------------------
> >>SF.Net email is Sponsored by the Better Software Conference & EXPO
> >>September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> >>Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> >>Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> >>_______________________________________________
> >>Jetty-support mailing list
> >>[hidden email]
> >>https://lists.sourceforge.net/lists/listinfo/jetty-support
> >>
> >
> >
> >
> > -------------------------------------------------------
> > SF.Net email is Sponsored by the Better Software Conference & EXPO
> > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> > _______________________________________________
> > Jetty-support mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/jetty-support
> >
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support