I must look into the access of the apache server.I've written a stand alone code for cheking the access of the apache server. Basically simply type the url it's accessable...But wen i run it through code it throws exception..
as java.io.IOException: Server came back HTTP response code: 403 for URL: http://10.98.12.151:80/server-status?auto
What's 403 response code ?? hw can one allow it to be accessible from stand alone code...
This really is my code connecturl = "http://" + ip + ":" + port + "/server-status?auto" targetURL = new URL(connecturl) HttpURLConnection httpURLConnection = (HttpURLConnection) targetURL.openConnection()
httpURLConnection.setUseCaches(false); httpURLConnection.setAllowUserInteraction(false); httpURLConnection.setDoInput(true); httpURLConnection.setRequestMethod("GET"); httpURLConnection.connect();
the 403 code is definitely an "access refused" code.
The reason is probably because of directive inside your httpd.conf file not getting an "Allow from" which includes the ip from the host you are attempting to run this program on.
for instance, you are trying running this from the client (10.98.12.10) and wish to look into the status from the webserver you've running on 10.98.12.151.
Make certain the httpd.conf file around the server has something similar to the next:
<Location /server-status> SetHandler server-status Order deny,allow Deny all # now make certain the consumer host is permitted for connecting for this location Allow from 10.98.12.10 </Location>
Best of luck.