You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jeremy Pierson <jp...@isolvetechnologies.com> on 2002/06/18 15:19:26 UTC

REPOST-UPDATED: Apache Tomcat/4.0.3 - HTTP Status 302 - Moved Temporarily

In a nutshell, I have ONE machine running ONE instance of Apache with
multiple virtual sites.  Each website runs it's own Tomcat 4.0.3 instance.
One virtual site communicates via HTTPS with another site on the same server
and gets only 302 status responses for ALL requests, even though requesting
the same resources with a browser (such as IE, Netscape) return the
resources without any problems - no redirects either.  I can change this
code and have the requesting server make successful requests to other secure
servers elsewhere, and other non-secure servers (elsewhere and on the same
box).  The virtual sites have different IP addresses as well.

Any ideas here?  Thanks!

-jeremy-



Here¹s a sample of the servlet code that makes the HTTPS request:


URL url = null;
HttpsURLConnection con = null;
PrintWriter pout = null;
BufferedReader pin = null;
try {
    url = new URL("https://secure.server.com/index.jsp");
    System.out.println("Connecting to '" + url.toString() + "'...");
    con = (HttpsURLConnection)url.openConnection();
    con.setFollowRedirects(false);
    con.setHostnameVerifier(
            new HostnameVerifier()
            {
            public boolean verify( String urlHost, SSLSession ssls ){
            if( !urlHost.equals(ssls.getPeerHost())){
            System.out.println("certificate <" + ssls.getPeerHost() +
            "> does not match host <" + urlHost + "> but " +
            "continuing anyway");
            }
            return true;
            }} );
    con.setDoOutput(true);
    con.setDoInput(true);
    con.setUseCaches(false);
    con.setDefaultUseCaches(false);
    
con.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
    ((HttpURLConnection)con).setRequestMethod("POST");
    StringBuffer params = new StringBuffer();
    params.append("auth_code=");
    params.append(URLEncoder.encode(auth_code, "UTF-8"));
    pout = new PrintWriter(con.getOutputStream());
    pout.println(params.toString());
    pout.flush();
    pout.close();

... Etc ...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>