6 Replies Latest reply: Apr 4, 2012 11:11 AM by dcminter RSS

    Subdomain Creation

    845348
      I am developing web site which include customer customization.so i need sub domain creation technique so that i can rewrite my
      URL form
      www.domain.com to www.customername.domain.com

      Thanks in advance
        • 1. Re: Subdomain Creation
          DrClap
          Nothing to do with servlets. Your domain will be interpreted by DNS ("Domain Name Service") servers all over the internet, so that's where you have to define those domains.

          Actually, to be more specific, in that case you would have to configure the DNS for the "domain.com" domain to send requests for "customername.domain.com" to your web application. Then you could use a filter (probably not a servlet) to interpret the domain name and store it (or the result of the interpretation) in request context for servlets to use.
          • 2. Re: Subdomain Creation
            845348
            thanks DrClap,

            now i will google for some help on that(Ur idea) to implement it in my application. If u have any thing on that please provide me those (if possible) so that i can implement it in my app

            thanks again for the help.
            • 3. Re: Subdomain Creation
              EJP
              JNDI with the DNS provider might be able to help you.
              • 4. Re: Subdomain Creation
                dcminter
                If you need to dynamically "create" subdomains another option can be to set up wildcard DNS resolution to point to your server and then use the host identifier submitted by the browser to determine how the server should respond.
                • 5. Re: Subdomain Creation
                  gimbal2
                  dcminter wrote:
                  If you need to dynamically "create" subdomains another option can be to set up wildcard DNS resolution to point to your server and then use the host identifier submitted by the browser to determine how the server should respond.
                  I guess such a trick could be used by services like blogger which allow you to pick a name and then instantly provide you a blog which is mapped to NAME.blogspot.com?

                  I always wondered how you could achieve such a thing.
                  • 6. Re: Subdomain Creation
                    dcminter
                    gimbal2 wrote:
                    I guess such a trick could be used by services like blogger which allow you to pick a name and then instantly provide you a blog which is mapped to NAME.blogspot.com?
                    Yep. If I remember rightly DNS itself doesn't support this directly but most DNS server implementations allow you to specify the wildcard form so that they will return the same IP for any name as the fallthrough (you can specify specific names e.g. mx.example.com as having distinct resolutions).

                    Edit: Wikipedia seems to disagree with me on that last - apparently the DNS protocol does explcitly support wildcarding.