I have a IdHTTPServer with a IdServerIOHandlerSSLOpenSSL which requires a login during connect, by setting the AuthRealm. This is intended to be used by a government organisation to view specific data.
But they have a massive security system in place, and the web browsers on their network do not accept, or do never receive, the initial Basic Autenthication request. They end up straight to 401: Unauthorized.
I think it is because it seems that the SSL encryption for the connection is not yet established when the initial login / password request is send to the Web browser, and as a result it is blocked. I can see this in my own web browsers as well. https is not yet active.
Is there a way around this? Can I somehow force the SSL connection, before the Basic authentication request is send?

HTTP-based authentication is part of the HTTP request itself. You have to send the request via an
https:url to ensure the connection is secured with SSL/TLS before the HTTP request is even transmitted. NEVER ask for HTTP-based authentication using anhttp:url !!! HTTPBASICauthentication itself is not secure, as it simply transmits the client's credentials in plain-text using base64. So the connection has to be secured beforehand.In any case, the screenshot you have provided clearly shows that an
https:url is being used. So yes, SSL/TLS encryption MUST be active on the connection BEFORE the client would send its HTTP request and consequently receive an authentication challenge.TIdHTTPServerwould not be able to communicate with any HTTPS client at all if that were not the case.TIdHTTPServerhandles HTTPS just fine, provided you have set it up correctly, ie by:having a
TIdServerIOHandlerSSLBase-derived component assigned to theTIdHTTPServer.IOHandlerproperty (which it sounds like you do)setting the
TIdSSLIOHandlerSocketBase(AContext.Connection.IOHandler).PassThroughproperty toFalsein theTIdHTTPServer.OnConnectevent for an SSL/TLS listening port (whichTIdHTTPServerhandles for you by default on the standard HTTPS port, 443).So, whatever problem you are having is related to something else. Do you have
TIdHTTPServerlistening on port 443? Do you haveTIdSSLIOHandlerSocketOpenSSLconfigured to use strong encryption, identity validation, etc? There are many factors at play which you have not provided details about.