HTTP to HTTPS redirect

Hi,

We are using RUT240/RUT241 as the modem for an embedded system running FreeRTOS.

On our backend we have a HTTPS endpoint (for PUT and GET requests)

Ideally we would like to send HTTP requests, that the RUT241 picks up and redirects as a HTTPS request to a remote server.

We have tried using stunnel both in client and server mode, though we have yet to have it redirect.

For server mode this is the settings we have used:
Enable - on
Operating Mode - server
Listen IP - 0.0.0.0
Listen port - 80
Connect IP’s api.oceanaccess.no:443
TLS Cipher - Secure
Application Protocol - Not specified
Cert file - server.crt
Private key - server.key

For client mode
Enable -On
Listen IP - 0.0.0.0
Listen port - 80 (we have also tried other ports and made the port change in our embedded system)
Connect IP’s - api.oceanaccess.no:443
TLS Cipher - Secure
Application Protocol - Not Specified
Remote server certificate - client1.crt

I see now that we have used the wrong format for the certs, will update this post if that is the only issue

Update:
Additional question, we are absolutely dependent on using DNS for out HTTPS endpoint, as it changes IP about once every 30 minutes

Changing the cert to a .pem file did not solve the issue (though that might be due to user-error on our end)

Solved it,

Disabled the GUI, then I

  1. Made some certificates in .pem format
  2. scp them into /etc/stunnel
  3. added this to stunnel.conf
    [https_to_http]
    ; Accept connection on HTTP and forward as HTTPS
    client = yes
    accept = 127.0.0.1:80
    connect = [API-URL]:443
    ; Specify certificates
    ; SSL certificates must be specified to establish a secure connection
    CAfile = [PATH TO CA FILE]
    cert = [PATH TO CERT FILE]
    key = [ PATH TO .key FILE]

[http_to_https]
; Receive HTTPS and forward as HTTP
client = no
accept = 443
connect = 127.0.0.1:80
; Dummy certificates - replace these with actual certificates
; Certificates can be obtained from a Certificate Authority (CA)
CAfile = [PATH TO CA FILE]
cert = [PATH TO CERT FILE]
key = [ PATH TO .key FILE]

Hello,

Thank you for sharing a solution to this issue!

Kind regards,