Roman Vitek
14.12.2007 12:49:13 Registered user |
Hi, I´m testing demo "RTC_WebForum" and I setup some virtual host: test=C:\Test
In folder "C:\Test" I have "index.htm". When I type "http://localhost/test/index.htm" in IE I get HTTP 404 erorr.
What I doing wrong ?
Thanks for answer
Roman Vitek
|
Danijel Tkalcec [RTC]
14.12.2007 13:38:44 Registered user |
Using the Virtual Hosts functionality in the RTC WebServer, you can have multiple different Hosts (like "realthinclient.com" and "fundelphi.org" for example) served from a single Web Server.
When you write a RTC Server which needs to host more than one domain, you can use the TRtcDataServer(Sender).Request.Host property to find out what the user has typed after http:// and before the path. In your case (http://localhost/...), it is "localhost", so ... if you wanted to have a special folder for when the Server is accessed through localhost, you could add an entry with "localhost=C:\Test" as one virtual host. In that case, every time you access your server through "http://localhost", the Server will be serving files from the C:\Test folder.
But, I don't think that is what you had in mind. Maybe the "virtual" part was misleading in the RTC WebServer demo, making you think that it would be a folder, while all you need to do to have a folder under your main hos is to place it there.
In other words, if you access "http://localhost/test/index.htm", the Server will be looking for the file "index.htm" in the "test" folder for the "localhost" entry in the Virtual Hosts list. In case you only have one domain to host, which is usually the case with servers used inside LAN and often the case when you have only one domain to care about, and you want to use the RTC WebServer to host your files, you will only need to change the default Virtual Hosts entry to point to a folder under which you will have all the files you want to host, organized in sub-folders.
Best Regards, Danijel Tkalcec
|
Danijel Tkalcec [RTC]
14.12.2007 13:58:25 Registered user |
The WebServer which you are now using is only an example on how the RTC SDK can be used to provide access to local files, PHP files and ISAPI DLLs. The WebServer demo implements access to local files through a single Data Module using the TRtcDataProvider component, which you can find in the Demos\rtcFileProvider unit. Since the RealThinClient SDK provides access to all HTTP headers through it's Request and Response properties, you can easily use that code to implement the "virtual directory" functionality you are asking for.
The same way the WebServer is now using the "Request.Host" property to implement Virtual Hosts, you could extend it to make use of the Request.FileName" property to implement Virtual Folders. If you are not sure how to start, I would recommend you to go through the Quick Start guide. What you will especially be interested in are the Server Lessons, which wil guide you from writing a simple "Hello, World" server to a server providing access to all files in a folder.
Best Regards, Danijel Tkalcec
|