Old phones can't speak TLS. This relay can. A lightweight PHP proxy that sits between your retro J2ME device and any modern HTTPS API โ no SSL headaches on the handset side.
Legacy J2ME devices (Nokia, SonyEricsson, early Androids) ship with ancient TLS stacks that fail handshakes against modern servers. The relay accepts plain HTTP from the phone, forwards the request over HTTPS to a Cloudflare Pages bridge, which in turn talks to any upstream API. The phone never touches TLS โ the relay handles everything.
The relay uses CURLOPT_SSL_VERIFYPEER = false intentionally โ it's the boundary where HTTP becomes HTTPS so old devices don't have to.
Every request carries a ?uid= parameter that identifies the session. The bridge uses it to match responses back to the correct device.
GET and POST are both forwarded transparently. POST bodies and Content-Type: application/json headers are preserved end-to-end.
Point the MIDlet at http://toasterrelay.whf.bz/relay.php and you're done. No certificates, no keytool, no MIDP 2.0 drama.
All requests go to relay.php. The relay always mirrors the HTTP status code and content-type from the upstream response.
| Method | Path | Parameters | Description |
|---|---|---|---|
| GET | /relay.php | ?uid= Session token |
Poll the bridge for a pending response for this UID |
| POST | /relay.php | ?uid= + JSON body Session token + payload |
Send a JSON payload upstream via the bridge (BYOT flow) |
From any J2ME HttpConnection, replace your target URL with the relay and pass your session UID.
// Open a plain HTTP connection โ no TLS needed on the device String uid = "mySession123"; String url = "http://toasterrelay.whf.bz/relay.php?uid=" + uid; HttpConnection conn = (HttpConnection) Connector.open(url); conn.setRequestMethod(HttpConnection.GET); int responseCode = conn.getResponseCode(); // responseCode mirrors what the upstream API returned InputStream is = conn.openInputStream(); // read JSON response normally...
// If something goes wrong the relay always returns JSON: { "error": "Relay: Missing UID" } { "error": "Relay cURL Error: ..." }
The relay is a single PHP file. Any shared host with cURL works.
// 1. Edit the bridge URL at the top of relay.php $CLOUDFLARE_BRIDGE = "https://your-project.pages.dev/api/bridge"; // 2. Upload relay.php to your HTTP hosting // 3. Point your MIDlet at http://yourdomain.tld/relay.php // That's it. No composer, no npm, no Docker.