• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Subdomains?

 
Ranch Hand
Posts: 41
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok here is what I'm wanting to do. I have my production site running on my domain.
I want to have a testing site thats a sub domain for development.


now I have all my DNS records set and everything is resolving.

So in my tomcat directory on top of the webapps dir i created a dev dir at the same level.

both dirs have ROOT directory.

here is an example of how my server.xml file is set up.




My question is why does both www.example and dev.example resolve and load the production page?
How do i get the other subdomain to refer to the /dev and not the /webapp directory ?

I 'm feeling kinda lost here so any point in the right direction would be great.
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DNS resolves (sub)domain names to ONLY the IP address. There is no provision whatsoever in DNS to resolve context names or even tcp/ip port numbers (like 8080). So the incoming URL must provide those little niceties the hard way.

What we do in the real world in cases like that is to point the incoming URLs to a proxy that has URL rewriting capabilities so that something like "http://dev.example.com" gets rewritten and routed to Tomcat as "http://dev.example.com:8080/devapp".
 
Joseph Swager
Ranch Hand
Posts: 41
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see what you mean now. However I only want to run the tomcat server and not use apache to proxy and remap all the URLS. I already have all port 80 traffic redirected to 8080 by the iptables. So is there a module or something to write in the configuration files allows if dev.example.com to be rewritten in the url dev.example.com/dev

im not worried about the port because all traffic is redirected to port 8080

Thank again for your reply.
 
Tim Holloway
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that there's a Tomcat Valve that can do URL rewriting and someone here on the Ranch found it a couple of months ago. I don't recall details, but maybe if you search around a little...
 
Joseph Swager
Ranch Hand
Posts: 41
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Tim thank you so much for all your help. I solved it with a virtual server within server.xml file. When I get back into the office I'll show the exact setup i set for <Host> tags. It works like a charm.
 
Tim Holloway
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good point. I tend to avoid defining apps as root contexts, since you can have only one root app per Host, but after all, that's all you wanted here!
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joseph Swager wrote:Hey Tim thank you so much for all your help. I solved it with a virtual server within server.xml file. When I get back into the office I'll show the exact setup i set for <Host> tags. It works like a charm.




Any chance you can collaborate how to solve this ??? I'm stuck on the same problem...

Thanks!!
Yair
 
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic