The HttpURLConnection‘s follow redirect is just an indicator, in fact it won’t help you to do the “real” http redirection, you still need to handle it manually. URL obj = new URL(url); HttpURLConnection conn = (HttpURLConnection) obj.openConnection(); conn.setInstanceFollowRedirects(true); //you still need to handle redirect manully. HttpURLConnection.setFollowRedirects(true); 1. Java Http Redirec
![Java HttpURLConnection follow redirect example - Mkyong.com](https://cdn-ak-scissors.b.st-hatena.com/image/square/e6b4dfd4f9f121afe7b1d1c5ddd5f364925a519e/height=288;version=1;width=512/https%3A%2F%2Fmkyong.com%2Fwp-content%2Fuploads%2F2023%2F08%2Fmkyong-opengrap-logo.png)