Aloe Express - force HTTPS ?

Hi there,

I’m using Aloe Express for a web app and it’s great ! The app is used on a small LAN, no connection to the web, no web server.
I’m using SSL with a self-signed certificate and it’s fine.

But the users have to explicitly connect to the app using HTTPS, https://ipaddress:port
In a Xojo web app I can force https in HandleURL, but Aloe Express is a console app.

Does someone know how to force HTTPS in Aloe Express ?

Thanks !

You’ll probably have to send a response with a 302 response code and a location header which points to the secure url.

Hi Greg,

Thanks. But if the user types the address with http:// I never get the request, so I can’t send a response.
The browser is just hanging, waiting, no error, no timeout…

It seems like your server is only listening on 443. Or port 80 is blocked in some way.

the Aloe server is configured to listen to port 8089:

Server.Port = 8089 Server.Secure = True

with https://ipaddress:8089 I get my index page, with http://ipaddress:8089 I don’t get the request.

I’m not an Aloe user, but looking at the docs, I think the right way to handle this is to run another insecure server on another port.

Thanks Tom,
That was indeed my alternative but it’s a bit overkill to create a 2nd app only to redirect http calls.
Maybe @Tim Dietrich has a better idea.

Thanks anyway

If 80 and/or 443 are already in use then you could always add another IP to the box then bind aloe to that, use the default ports (80/443) then you dont need to bother with the :port on the end. Then from a web browser any request for http will go to 80 and https to 443. Add another aloe on 80 to redirect to 443, thats just the way things are done. From the OP I see you’re not using a modem/router and if you dont want to use https://ip/ then add and entry to your /private/etc/hosts file (mac/linux) or hosts file (windows) so you can type something like https://intranet/

Hi Julian,

Thanks for this. I was using the hosts file and still do, but now most of the users are using their own mobile phones and tablets, where there are no hosts files per se.
Maybe the easiest would be to install a DNS server somewhere on the LAN (there is no server).

Can you add a name brand ssl certificate to aloe ?

I haven’t used Aloe yet, though I plan to check it out, but I do know that other webservers can’t listen for two different protocols (https & http) on the same port. You’ll likely have to put your http requests on another port and do a redirect to the https port number.

As @Julian Samphire mentioned, 80 is standard for http and 443 is for https. If you use the standard port numbers, then they don’t need to be included in the URL.

Good luck!

Correct, and Aloe does seem to support multiple ports. It has a config option: Secure = True, which implies SSL.
I’ll have to poke around a but since if it does support SSL, you need to, by definition, put a certificate someplace…