Jump to content

Recommended Posts

Posted

If you want to close port 80 totally, you can do it on the server's firewall.

If not, you can redirect port 80 calls to the SSL port if you run the app as a DLL, e.g for apache:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L] 

I'm sure you can do the same thing for IIS.

  • 8 months later...
Posted

Up. I want to do it on the UniGUI side, I don't want to set any dummy port for later disable it :)

It has very simple solution (when sources is accessible, but we unfortunatelly has no sources, and have to bother support).

Just bind one port and use same port for https connections and that's all:

 IdHTTPServer1.Bindings.Add.Port := HTTPPort;

procedure TWebDataModule.IdHTTPServer1QuerySSLPort(APort: word; var VUseSSL: boolean);
begin
 VUseSSL := APort = HTTPPort;
end;
 

That's all.

Posted
11 hours ago, andyhill said:

Server Options

soAutoRedirectHttps

Thanks all for reply. Does this option needs only one port? If no, then it's wrong solution for me. I need to open only one port, not both for http and https.

Posted
25 minutes ago, Tokay said:

Thanks all for reply. Does this option needs only one port? If no, then it's wrong solution for me. I need to open only one port, not both for http and https.

Hello, Can You explain more of Your needs?

You want to disable port or just redirect to https ?

Your examples with Indy are equivalent to soAutoRedirectHttps = True

Posted
3 hours ago, irigsoft said:

Hello, Can You explain more of Your needs?

You want to disable port or just redirect to https ?

Your examples with Indy are equivalent to soAutoRedirectHttps = True

I need only one listened port with https connection on it.

Posted

ServerModule
UniGUIServerModuleBeforeInit

// Remove Default Project HTTP Port
Bindings.BeginUpdate;
Bindings.Clear;
Bindings.EndUpdate;

// Add HTTPS port
SSL.SSLBindings.BeginUpdate;
SSL.SSLBindings.Clear;
with SSL.SSLBindings.Add do begin
  IP:= BindToSslIP;
  Port:= SslPort;
  BroadcastEnabled:= True;
end;
SSL.SSLBindings.EndUpdate;
 

Posted

Unfortunatelly your solution doesn't works here. Software shows message 

[Window Title]
Test

[Content]
Could not bind socket.

[OK]

And application closed.

Posted
14 hours ago, Hayri ASLAN said:

Hello

Do you want to disable http port completely or you want redirect users visited "http://yoursite" to "https://yoursite" ?

I want to disable (even don't bind) any http port. Bind any one port for https and that all.

It definitely possible in the Indy library, our 'main' web works well in such mode.

  • 5 weeks later...
  • 4 weeks later...
Posted
On 7/21/2021 at 10:00 AM, Tokay said:

I want to disable (even don't bind) any http port. Bind any one port for https and that all.

Hello, I am sorry but I can't understand what You really want.

I am very interested in security and I want to know what the problem is. Have you tried my suggestion using UniGUIServerModuleHTTPCommand or UniGUIMainModuleHandleRequest, you can ignore all http ports, just check for data in UniSession.ARequest.Referer

If You just disable request from http:// ?

 like this on UniGUIMainModuleHandleRequest:

 

if (UniSession.ARequest.URI = '/HandleEvent')
then begin
        //redirect to https
     If POS (''http://', UniSession.ARequest.Referer) > 0 then begin

        UniSession.AResponse.ResponseNo := 308;
        UniSession.AResponse.ResponseText := 'redirected';
        UniSession.TerminateAfterSecs(2);

        //redirect to https
        //RedirectURL := StringReplace(RedirectURL, 'http://', 'https://', [rfIgnoreCase]);
        UniSession.UrlRedirect (RedirectURL);
    end;

Posted
11 minutes ago, Tokay said:

Issue is not about the security, but about ports binding. It's more convenient to bind only one port for us.

Can You give me some example (code or some image) ?

Posted

@tokay is that what You want

"I have hosted my site on TCP port 91. Is there a way to bind their SSL certificate on that same port 91?
I'm interpreting this question as "I'm running my site on http://www.mysite.example:91/ and I also want to run it for HTTPS at https://www.mysite.example:91/" (in which case it's not a duplicate of Multiple SSL domains on the same IP address and same port?, as temporarily marked)."

 

from here : https://serverfault.com/questions/342246/how-to-bind-website-and-its-ssl-version-using-the-same-port 

  • 1 month later...
Posted

I've finally found solution in the manual: 'The next parameter to confgure is the SSL port. You can leave it to its default value of 0. In this case you can access your server through the port configured in ServerModule -> Port which is 8077 by default.'. Sorry for annoyance.

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...