PDA

View Full Version : Can somebody please help me getting virtual servers on webserver to work?



Mastiff
December 6th, 2017, 05:39 AM
I really need this because I have two parts of my house, one that's rented out and one that we live in. Both have heat and audio control, but I have not yet been able to let the renters use a webpage to control it since I can't figure out how to separate them easily, with an URL that goes directly to the correct page, not one start page where you have to go to the correct page for the part of the house. To test it I have created a file named C:\Program Files (x86)\Promixis\Girder51\plugins\webserver\hosts.tx t and it contains these lines:


192.168.0.100=D:\Girder\Webserver1
127.0.0.1=D:\Girder\Webserver2


In the webserver config I have D:\Girder\Webserver1 as the directory. But that's all I get to no matter what IP i use (I'm of course testing it locally for the 127.0.0.1 to work). I have been reading both the manual and an old thread:

https://www.promixis.com/forums/showthread.php?20851-webserver-plugin-different-instances-related-to-local-ip-adresses

In there Ron says:


...you can do virtualhosts like this:



chrome=c:\devel\girder\trunk\girder4\httpd
127.0.0.1=c:\devel
192.168.2.200=c:\windows


The parser is quite picky so make sure you end with one endline for this to work. And also adjust to your own names and IP addresses.

From what I can see there my setup really should be working. I don't get the part about one endline, but I have tried both with an empty line and without one. Or is endline in this respect something else? Can it be that the hosts.txt file should be in another place? Or is there anything else I can try? I really need this to work to give my renters acces, so can somebody please take pity in me?

Tieske8
December 7th, 2017, 08:29 AM
I'm not sure, but it seems to me the webserver responds based on the `Host` header of the request, so make sure your request has one. This is a bit hard to test from the browser, since it won't let you add the header manually.

So from the system that hosts the webserver, if you use a browser and goto `http://127.0.0.1/` then the browser would set the host header to `127.0.0.1` and you should end up on `D:\Girder\Webserver2`

From any other system in your network you can point the browser to `http://192.168.0.100/`(assuming your webserver is reachable on 192.168.0.100). The browser will now set the host header to `192.168.0.100` and you should end up on `D:\Girder\Webserver1`

Mastiff
December 7th, 2017, 09:57 AM
THanks for answering! is there any way to see what host header a request has in Girder?

Tieske8
December 7th, 2017, 01:37 PM
I wouldn't know. But to craft a request with a custom host header you could use Postman; https://www.getpostman.com/apps

Mastiff
December 8th, 2017, 03:04 AM
Thanks! I'll check that out.