leons Posted January 11, 2020 Share Posted January 11, 2020 Hi Is it possible to ignore the http;//xxapplicationxx/server based on an ip address? I want to allow the access to the server monitor from certain ipaddresses and ignore the other requests. regards leon Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 11, 2020 Share Posted January 11, 2020 6 hours ago, leons said: Is it possible to ignore the http;//xxapplicationxx/server based on an ip address? I want to allow the access to the server monitor from certain ipaddresses and ignore the other requests. Hi, UniServerModule.BlockedIPList UniServerModule.WhiteIPList Or using login and password, please see this demo: \FMSoft\Framework\uniGUI\Demos\Desktop\ServerControlPanel procedure TUniServerModule.UniGUIServerModuleControlPanelLogin( ASession: TUniGUISession; const Auser, APassword: string; var LoginValid: Boolean; LoginAttempt: Integer); begin if SameText(AUser, 'demo') and SameText(APassword, 'demo') then LoginValid:=True else begin if LoginAttempt=3 then ASession.Terminate('Login Failed'); end; end; Quote Link to comment Share on other sites More sharing options...
leons Posted January 12, 2020 Author Share Posted January 12, 2020 Hi Sherzod Thx for your answer. Just to be shure, BlockedIPList disables access to the full application, not only the /server option. Regards Leon Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 12, 2020 Share Posted January 12, 2020 Hi Leon, Do you want only for "server" option? Quote Link to comment Share on other sites More sharing options...
leons Posted January 12, 2020 Author Share Posted January 12, 2020 Hi Sherzod, yes that was my intention. regards Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 13, 2020 Share Posted January 13, 2020 12 hours ago, leons said: yes that was my intention. UniServerModule: procedure TUniServerModule.UniGUIServerModuleHTTPCommand( ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean); var s: string; begin s := ARequestInfo.Document.ToLower; if (s.StartsWith('/server') and (ARequestInfo.RemoteIP = '127.0.0.1')) then begin AResponseInfo.ResponseNo := 401; AResponseInfo.ContentText := 'Access denied!'; Handled := True; end; end; 1 Quote Link to comment Share on other sites More sharing options...
MR-Irawan Posted November 11, 2021 Share Posted November 11, 2021 This is what I looking for, thanks 1 Quote Link to comment Share on other sites More sharing options...
irigsoft Posted January 18, 2022 Share Posted January 18, 2022 @Sherzod, If I have a WhiteIPList filled with some IP addresses, these IP addresses are allowed to work with the unigui server. I filled in some IP addresses in my WhiteIPList because they are secure, but I want other IP addresses to work, is this possible if I have a WhiteIPList filled in or only the IP addresses in this list can access the server? Example: 1. WhiteIPList populated with: 121.45.55.66 2. I try to connect with this IP (121.45.55.66) and everything is fine 3. If i try to connect with IP 21.22.33.99, then I get "Access denied 21.22.33.99" How to enable IP 21.22.33.99 to work with a server without adding it to WhiteIPList? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 18, 2022 Share Posted January 18, 2022 1 hour ago, irigsoft said: 3. If i try to connect with IP 21.22.33.99, then I get "Access denied 21.22.33.99" Hello, I think it's easier for you to add this IP to WhiteIPList. Quote Link to comment Share on other sites More sharing options...
irigsoft Posted January 18, 2022 Share Posted January 18, 2022 22 hours ago, Sherzod said: Hello, I think it's easier for you to add this IP to WhiteIPList. I will use this logic and must to know what is right way to do it. "In this situation, there are some limitations that the user will encounter: 1. My application is not a website, this is a web application, REST server, etc. and it will need access data. 2. If the user wants to connect to this web application, then he will need: 2.1 full URL of the application (there is some data that you will receive from the owner of the server to connect to the application) 2.2 user and password 3. If they know this information and want to use a Site-to-Site VPN, then they will receive information about which country they will need to use to connect to the web application. 4. A certain IP address can always be added to the list of trusted addresses (WhiteIPList) and blocking by country will not be affected I think that the combination of all these parameters will allow the normal operation of even such users."" So 1. if IP from another Country is in WhiteIPList, then will not be blocked 2. I try it but when is populated some Ip's in WhiteIPList, then every IP outside of this list is blocked. So this is a bug with WhiteIPList or is the right way to work ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 18, 2022 Share Posted January 18, 2022 2 minutes ago, irigsoft said: So is this a bug with WhiteIPList, or is right way to work Your question regarding WhiteIPList is not very clear. 3 minutes ago, irigsoft said: 1. if IP from another Country is in WhiteIPList, then will not be blocked 2. I try it but when is populated some Ip's in WhiteIPList, then every IP outside of this list is blocked. If I understand you correctly, that is exactly how it should work. Quote Link to comment Share on other sites More sharing options...
irigsoft Posted January 18, 2022 Share Posted January 18, 2022 2 hours ago, Sherzod said: Your question regarding WhiteIPList is not very clear. If I understand you correctly, that is exactly how it should work. I create my logic in another topic, when the ip is in the whiteiplist, then I do not check this ip by country. if it's not there, then I'm checking the state. But I understand that if I put some IP addresses in whiteIpList, then only those IP addresses can connect to my server, others are blocked by default from the unigui framework. Am I right ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 18, 2022 Share Posted January 18, 2022 Yes. 1 Quote Link to comment Share on other sites More sharing options...
irigsoft Posted January 18, 2022 Share Posted January 18, 2022 2 minutes ago, Sherzod said: Yes. well, then I have to change my logic to the other topic Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.