Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to deploy the WAR file of Apache Shindig to an apt-installed Tomcat 6 server on Ubuntu 10.04. Unfortunately, when it writes out things like <script> tags, all the URLs are http://localhost/..., even though I think I've told Tomcat that this server has an external name. The non-comment contents of my server.xml file are here. This is essentially the default configuration, save for that I've changed all instances of localhost to my.external.hostname (of course, my actual hostname in the actual configuration file).

How do I get Tomcat6/Shindig to realize that it lives at my.external.hostname so it doesn't refer to http://localhost/...?

<?xml version='1.0' encoding='utf-8'?>

<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               URIEncoding="UTF-8"
               redirectPort="8443" />
    <!-- *** THIS IS WHERE IT GETS INTERESTING: hostname set here: -->
    <Engine name="Catalina" defaultHost="my.external.hostname">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
      <!-- *** and here: -->
      <Host name="my.external.hostname"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      </Host>
    </Engine>
  </Service>
</Server>
share|improve this question

2 Answers 2

Have you seen this bug entry Shindig Jira Issue 272? At least in last December there were no news on a potential resolution. Obviously some hard coded paths are in the way of using a different servlet container than Jetty if your hostname should not be localhost. There is a temporary solution described in the Jira ticket. Does it work for you?

share|improve this answer
    
That seems to deal more with the path in the deployment; I have mine at ROOT... –  Paul Fisher Feb 6 '11 at 19:21
up vote 0 down vote accepted

It turns out that there's a separate settings file for Shindig that isn't mentioned in the setup documentation. You have to edit the WEB-INF/classes/containers/default/container.js file in order to change the host name. There are a bunch of places that use ${HOST_NAME} or localhost, which I changed to my.external.hostname. Now it works!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.