![]() |
both HTTP and HTTPS in same IW service app? - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- Thread: both HTTP and HTTPS in same IW service app? (/thread-3789.html) |
both HTTP and HTTPS in same IW service app? - chiswilson - 01-17-2024 Hi all- Quick question, I think the answer is Yes, but I just wanted to confirm... Can one single IW application (service) support both HTTP and HTTPS ? (Im using http.sys, not OpenSSL) Thanks. RE: both HTTP and HTTPS in same IW service app? - chiswilson - 01-19-2024 Hoping I could get a response on this from AToZed ... Thank You. RE: both HTTP and HTTPS in same IW service app? - jeroen.rottink - 01-19-2024 Hi, Not the answer from Atozed but still usable I hope ![]() One way is to use the TIWServerController.OnBind event. Code: procedure TIWServerController.IWServerControllerBaseBind(const aHttpBindings, aHttpsBindings: TStrings); For https make sure SSLOptions.Port is set like for Indy servers. RE: both HTTP and HTTPS in same IW service app? - Alexandre Machado - 01-19-2024 Yes, it is possible (and quite common) but it is the same application running both as HTTPS and HTTP. @Jeroen's answer is correct, but there is no need to have custom code to make both bindings.... ServerController.SSLOptions.Port is also used to configure Http.sys servers. In this case, you just need to set: Code: ServerController.Port := (your HTTP port, default is 80) What will determine the behavior of the application is the property ServerController.SSLOptions.NonSSLRequest It can be either: nsAccept (default), nsRedirect and nsBlock nsAccept: incoming requests using HTTP port will be accepted and everything will run using HTTP only protocol nsRedirect: any incoming request using HTTP port will be redirected to HTTPS port (if HTTPS is enabled, i.e. you have ServerController.SSLOptions.Port > 0) nsBlock: any incomping request using HTTP port will be blocked. In this case the HTTP server won't even listen to the HTTP. No response for HTTP request will be generated. You can also have forms that are only accessible via HTTPS or HTTP and others that are accessibla via both protocols. In that case you need to use the property IWForm.ConnectionMode It can be either: cmAny (default): HTTP and HTTPS are accepted cmSecure: Form will only accept HTTPS cmNonSecure: Form will only accept HTTP RE: both HTTP and HTTPS in same IW service app? - chiswilson - 01-19-2024 Perfect, thanks, I look forward to trying this. ![]() CW |