Saturday, August 26, 2017

Re: GWT Application gets “404 The requested resource is not available”.

Hi Jen,

Thank you so much for your reply. However, I heard that mod_proxy is slower that Mod JK, so I made a switch just a little while ago :)

Here is what the users expect.

1.If the users type (http://)www.zethanath.tk in the browser, mod_rewrite, near the end of http vhost conf,
would redirect the user to (https://www.zethanath.tk). I am using mod_rewrite here.

<
VirtualHost *:80 >

...

RewriteEngine on RewriteCond %{SERVER_NAME} =www.zethanath.tk RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

</VirtualHost>
 
2. At this point, SSL vhost should use Mod JK to redirect the users to my GWT application on TomEE Server. My GWT application, in this case, is stored at /opt/tomcat/webapps/ with the name Index.war. but I do not know why I keep getting "404 The resource is not available".

<IfModule mod_ssl.c>    <VirtualHost _default_:443>
...
  
DocumentRoot
"/opt/tomcat/webapps/Index"

  JKMountCopy On    JKMount /* ajp13_worker

  ...  

</VirtualHost> </IfModule>

I can see my GWT application working correct as http://192.168.1.70:8080/Index from Firefox, but I do not know why I got 404 error.
I allow 8080 on my firewall and router. I assigned 775 permission on Index.war, as well as the associated Index directory.

Maybe the statement here does not take port 8080 into consideration ? -> "DocumentRoot "/opt/tomcat/webapps/Index"
Maybe I should try get rid of this same line within http vhost config file?



On Saturday, August 26, 2017 at 12:08:31 PM UTC-7, Jens wrote:
Looks like you want to use Apache + Tomcat. In that case you need to configure Apache as reverse proxy to your Tomcat. There are basically two variants:

1.) Your complete GWT app (GWT JavaScript, index.html, all server code) is inside your *.war file. In that case you would proxy any request to your domain to tomcat which usually runs on localhost:8080. So your virtual host in Apache would contain something like ProxyPass / http://localhost:8080/Index 

2.) You let Apache serve all the static files (GWT JavaScript, index.html) and tomcat only has the server code of your app in your *.war file. In that case your Apache virtual host would have a document root pointing to the folder of your GWT app and only requests to tomcat (server requests your app  makes using GWT-RPC, RequestBuilder, REST, whatever you use) would need to be proxied by Apache. So you might end up having more proxy configuration. This is more an optimization solution because you can now tune apache to serve static files and tune tomcat to deliver dynamic content.

You should google for Apache mod_proxy to find some more documentation on reverse proxying using Apache.

-- J.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment