Recent

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

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
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
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • 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: 2256
    • Lazarus and Free Pascal italian community
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.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 1312
    • 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

  • Hero Member
  • *****
  • Posts: 535
    • 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.

 

TinyPortal © 2005-2018