0

I have few applications (in fact 3) running in tomcat. One uses domain (domain.com) and other uses sub domains. And here comes the problem. Everything works good, until i use in my application from subdomain:

return "redirect:/dashboard";

The problem is that, it redirects not to subdomain.domain.com/dashboard but to domain.com/dasboard. Tomcat server.xml host config :

<Host name="subdomain.domain.com" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="subdomain"/>
</Host>

1 Answers1

1

You need to write the complete URL:

return "redirect:http://www.domain.com/dashboard";
Stefan
  • 11,176
  • 5
  • 40
  • 62
  • there are no other way to fix this problem? Maybe some tomcat or apache configs? – user3631404 Sep 07 '14 at 13:48
  • your answer not solves my problem. Because when i redirect to full url my session become lost... – user3631404 Sep 07 '14 at 20:13
  • Yes that happens, if your session id is saved in a cookie. See [here](http://stackoverflow.com/questions/18492576/share-cookie-between-subdomain-and-domain) how to share a cookie between a domain and its subdomains. – Stefan Sep 08 '14 at 07:46
  • Fixed session editing config in Tomcat. `...` – user3631404 Sep 09 '14 at 17:32