Max3073 Posted September 1, 2023 Share Posted September 1, 2023 Hello! I would like to make a UniGUI Application that can show a specific form according to the URL. I don't want to use parameters I need to use specific URIs Example: http://localhost:8077/hello must show a form with some content Unfortunately using a URL other than http://localhost:8077 results in "Invalid session or session Timeout. (Invalid URI: /hello )" Is there a solution? Thank you. Quote Link to comment Share on other sites More sharing options...
Israel Portillo Posted October 13, 2023 Share Posted October 13, 2023 X2 Did you resolve it ? Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted October 14, 2023 Share Posted October 14, 2023 instead of "/hello" you can use q=hello. Please check URLParameters demo Quote Link to comment Share on other sites More sharing options...
Max3073 Posted October 14, 2023 Author Share Posted October 14, 2023 Thank you for your suggestion. I konw that but I wrote it in the second line of my first message: "I don't want to use parameters I need to use specific URIs" Quote Link to comment Share on other sites More sharing options...
Norm Posted October 15, 2023 Share Posted October 15, 2023 An alternative is to insert "?" before the various URI's (e.g. http://localhost:8077/?hello) Then in ServerModule you can do: procedure TUniServerModule.UniGUIServerModuleHTTPCommand(ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean); begin if (ARequestInfo.Command = 'GET') and (ARequestInfo.URI = '/') and (ARequestInfo.QueryParams)>"")then begin //Here you can store the URI into a global variable in ServerModule that you can interrogate in the resulting session // e.g. LoginURI := ARequestInfo.QueryParams // this stores the URI without the "?" end; 1 Quote Link to comment Share on other sites More sharing options...
Ron Posted October 21, 2023 Share Posted October 21, 2023 I guess you can solve this using hyperserver and aliases in the web server setup, running two separate instances of the app, one in each directory: <Directory "C:/myapp1> Options FollowSymLinks ExecCGI AllowOverride None Order allow,deny Allow from all DirectoryIndex myapp.dll?q=param1 </Directory> Alias /option1 "C:/myapp1" <Directory "C:/myapp2> Options FollowSymLinks ExecCGI AllowOverride None Order allow,deny Allow from all DirectoryIndex myapp.dll?q=param2 </Directory> Alias /option2 "C:/myapp2" So the URL would be https//mydomain.com/option1 or 2, as the dll is specified as the folder index. You may skip using a parameter, by just checking startup directory to determine which alias was used. Using a URL Rewrite function in the web server setup is another option, to translate part of a URL to a parameter. Quote Link to comment Share on other sites More sharing options...
Max3073 Posted October 22, 2023 Author Share Posted October 22, 2023 Thank you Ron, this is very interesting, but I'm using UniGUI as a service. Quote Link to comment Share on other sites More sharing options...
Ron Posted October 23, 2023 Share Posted October 23, 2023 I see, then you could probably use a simple proxy server with only url rewriting capabilities, like EZProxy: https://help.oclc.org/Library_Management/EZproxy/Get_started/About_URL_rewriting Edit: I did not notice that EZProxy costs money, but there are probably other free proxy servers out there, or you could even build your own using Indy components. It is basically two http servers and two clients, feeding data from each server to each client in a cross pattern, being on different ports or IPs.* And then just add a url rewrite function, to convert the last part of the url to a parameter format. 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.