1
votes

I had done simple setup:
Backend(website): 1 machine having tomcat installed and serving on 8080.
webapps folder of tomcat has two folder

1 withGoogleRule1
       |--test.html
2 withoutGoogleRule1
       |--test.html

Now i have a google-load-balancer setup with below settings

enter image description here

Now Backend machine direct ip is http://104.197.37.171:8080/withoutGoogleRule1/test.html

Load Balancer url is http://107.178.240.39:8080/withoutGoogleRule1/test.html

PROBLEM:

No matter how many time we refresh url for direct machine, all requests always servers correctly.

But if you access url using load balancer 1 out of 5 time it shows

The requested URL /withoutGoogleRule1/test.html was not found on this server.

Details:

Youtube Video showing the failure of request

PS:

Instance group details:

enter image description here

LoadBalancer backend details

enter image description here

1
Could you elaborate on what "withGoogleRule1" and "withoutGoogleRule1" mean? What is your intention here? I am confused, you configured the URL map for withGoogleRule1, but you were trying to access withoutGoogleRule1.Dagang
You can check your Tomcat log to make sure if the 404 was returned by itself or the load balancer.Dagang
What is the type of your instance group? Managed or unmanaged?Dagang
I noticed in your instance group and backend service, you mapped http to 80 and 8080. And in the health check, you used port 80.Dagang
"withGoogleRule1" and "withoutGoogleRule1" are just for testing purpose.. "withGoogleRule1" is a url which is added in google "host and path".... "withoutGoogleRule1" is a url which is not added in host and path section of google.Bhuvan

1 Answers

1
votes

If your Tomcat was listening only on 8080 instead of 80, then the instance group, backend service configs were problematic. In particular, the health check was configured to check port 80, which would make the load balancer think the backend service was not healthy and return 404.

In addition, you can check Tomcat log to see how many requests were received and what were the responses.

Edit: Since you confirmed another process was listening on 80. The reason for 404 NOT FOUND could be, the requests were dispatched internally to 80. You can verify this theory by hosting a page on both 80 and 8080, e.g. /a.html, but the content is different, one is "i'm 80", the other is "i'm 8080". This way, you can know exactly what happened. Checking the log of the process listening on 80 can also help.