Android HttpURLConnection redirect XCIPTV

Published by

Posted on February 10, 2021

I figured I would post this information to save others some time. Here’s the background.

I wanted to separate the XCIPTV panel from my primary web domain. I also wanted to do this without forcing users to upgrade the APK so I decided to setup a .htaccess file and redirect the APK/API to a new address . After spending hours thinking it was a server side issue. I have figured out its the way the XCIPTV app was coded . It has to be coded to follow the web redirects. I thought the web client class in the APK would follow the redirect by default which is does.

My problem is dead smack in the class definition

Response Handling
HttpURLConnection will follow up to five HTTP redirects. It will follow redirects from one origin server to another. This implementation doesn’t follow redirects from HTTPS to HTTP or vice versa.

I was trying to redirect from https to http . long story short, this idea is bad and will not work.