* * *

Author Topic: HTTP Server Application question  (Read 1106 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 1712
HTTP Server Application question
« on: May 25, 2018, 12:23:48 pm »
Hi guys, I made a small HTTP Server Application. But I would like to understand how to use the https protocol. The final project must run on a linux server. Thank you, attached my sample program to change to use https
Ubuntu and Mac
Lazarus: 1.8.0
FPC: 3.0.4

Leledumbo

  • Hero Member
  • *****
  • Posts: 7947
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: HTTP Server Application question
« Reply #1 on: May 25, 2018, 02:13:17 pm »
Currently you must use a reverse proxy that already implements HTTPS. Server side of fcl-web doesn't support it yet.

xinyiman

  • Hero Member
  • *****
  • Posts: 1712
Re: HTTP Server Application question
« Reply #2 on: May 25, 2018, 02:20:21 pm »
Other alternatives? Other components, perhaps from third parties, who have examples to do what I want? We accept advice.
Ubuntu and Mac
Lazarus: 1.8.0
FPC: 3.0.4

Remy Lebeau

  • Sr. Member
  • ****
  • Posts: 448
    • Lebeau Software
Re: HTTP Server Application question
« Reply #3 on: May 30, 2018, 07:21:19 pm »
Other alternatives? Other components, perhaps from third parties, who have examples to do what I want? We accept advice.

Indy (which is available in Lazarus' OPM) is cross-platform and works on Linux.  Among many components, it has a TIdHTTPServer component which supports SSL/TLS connections for handling HTTPS.

- Assign a TIdServerIOHandlerSSLBase-derived component (such as TIdServerIOHandlerSSLOpenSSL) to the TIdHTTPServer.IOHandler property, and configure it as desired (enabled SSL/TLS versions, certificates, etc).

- Configure the TIdHTTPServer.Bindings property with the desired local IP:Port pair(s) that you want to accept connections on.  For HTTP, you should have a Binding on port 80, and for HTTPS, you should have a Binding on port 443.  Though you can use any port(s) you want (in which case URLs to your server will have to specify those ports explicitly).

- If you use an SSL port other than 443, assign a handler to the TIdHTTPServer.OnQuerySSLPort event, and have it return True or False based on whether the provided APort parameter is a desired HTTPS port.

- Assign handlers to the TIdHTTPServer.OnCommand... events as needed, such as OnCommandGet.
« Last Edit: July 20, 2018, 06:44:54 pm by Remy Lebeau »
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

Trenatos

  • Sr. Member
  • ****
  • Posts: 428
  • Software developer - Open source contributor
    • MarcusFernstrom.com
Re: HTTP Server Application question
« Reply #4 on: July 20, 2018, 05:15:03 pm »
Personally I'd just put it behind an nginx proxy, pretty standard setup for web deployments.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus