Jump to content

Recommended Posts

Posted

not sure if the title makes sense, but ill try to explain what Im trying to do.

 

I have a number of network devices that have embedded http servers in them. I only have 1 static IP, and port 80 is forwarded to my web server. Im looking for a way of making a couple of pages on that web server, that will embed the pages from the various other servers,, within the page.

 

I had one idea of using the very same php proxy thing thats used to get to facebook.com etc, but it didnt give me access to internal 192.168.x.x addresses..

 

Is there a known / standard way to do what im wanting to do, or should I have a go at hacking up the php proxy thing to allow access through to 192.x addresses?

Posted (edited)

but you cant access a internet ip from a external site.

you will have to do a subdomain "site2.domain.co.uk" and do som dns stuff and forward it to the web server with on NAt with the pages on..

 

it all sounds good in my head..

Edited by Cools
Posted

Port forwarding I had thought of, but the embedded http servers of the devices don't have any authentication, so if i forwarded say port 8000 on the router to port 80 on the LAN device, it would just give direct access.

 

I was hoping to somehow just create a page, with htaccess set up for authentication, that would have a link that I could just click that would bring the other http server to the current page.

 

Ill have a look at reverse proxy-ing, but I feel it might just be a bit

 

@ Cools: Im a bit lost...

 

I think it might just be a bit easier to hack apart the php-proxy thing.. Ill give it a go..

Posted
Port forwarding I had thought of, but the embedded http servers of the devices don't have any authentication, so if i forwarded say port 8000 on the router to port 80 on the LAN device, it would just give direct access.

 

I was hoping to somehow just create a page, with htaccess set up for authentication, that would have a link that I could just click that would bring the other http server to the current page.

 

Ill have a look at reverse proxy-ing, but I feel it might just be a bit

 

@ Cools: Im a bit lost...

 

I think it might just be a bit easier to hack apart the php-proxy thing.. Ill give it a go..

 

I'd say your best solution would be a mix of reverse proxying and adding authentication to your apache config file for the entire domain (or whatever you wish to do).

 

It is very simple in the end. ie. enable mod_proxy (i have mod_proxy, mod_proxy_connect, mod_proxy_http, mod_proxy_ftp enabled), then add the following lines to your conf file:

 

ProxyRequests Off

ProxyPass /blah http://192.168.1.1

ProxyPassReverse /blah http://192.168.1.1

 

Then you can add your usual auth block and voila.

Posted

If your main page can be ASP or PHP then it's easy - you get the public web server to call the pages from each of the internal devices. something like this should work (save this as status.asp on your web server, for example)

 

<%

response.write GetPage("http://192.168.0.1/statuspage")

response.write GetPage("http://192.168.0.2/statuspage")

 

Function Getpage(sURL)

Set oXML = CreateObject("Msxml2.ServerXMLHTTP")

oXML.Open "GET", sURL, False 'false means wait for page

oXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

oXML.Send

GetPage=cstr(oXML.responseText)

Set oXML = nothing

end function

 

 

 

%>

Posted
If your main page can be ASP or PHP then it's easy - you get the public web server to call the pages from each of the internal devices. something like this should work (save this as status.asp on your web server, for example)

 

<%

response.write GetPage("http://192.168.0.1/statuspage")

response.write GetPage("http://192.168.0.2/statuspage")

 

Function Getpage(sURL)

Set oXML = CreateObject("Msxml2.ServerXMLHTTP")

oXML.Open "GET", sURL, False 'false means wait for page

oXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

oXML.Send

GetPage=cstr(oXML.responseText)

Set oXML = nothing

end function

 

 

 

%>

 

Thats exactly the kind of thing Im looking for. Most my sites are php so thats no problem.. Is there a php equivelent of that code?

Posted
before I start looking at localzuk's method, could anyone tell me if there is anything obvious in this that I could change that would allow it to access a local IP...

 

When I try it currently, i get the blacklisted blah error message:

 

edugeek private pastebin - collaborative debugging tool

 

cheers

 

I take it thats phproxy. The code for the blacklisting is in a different file (index.php i think).

Actually yes it is, ive just looked.

 

$_hosts             = array

                   (

                       '#^127\.|192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[01])\.|localhost#i',
                   );

 

Look for that in index.php and if you change it so its

 

$_hosts             = array

                   (

                   );

should do the trick me thinks. (i havent had time to check)

 

Jack

  • Thanks 1
Posted

i was looking at the wrong file.. cheers

 

that works for giving me access to the things i want, but fails miserably to display the things I want.

 

thanks though,

 

ill need to try the other way

Posted
i was looking at the wrong file.. cheers

 

that works for giving me access to the things i want, but fails miserably to display the things I want.

 

thanks though,

 

ill need to try the other way

 

what exactly is wrong with it?

 

If you used cURL wouldnt you have to do some sort of url-rewriting for the pages to be useable?

 

& in my personal opinion i would use the reverse proxy method localzuk suggested.

 

Jack

Posted

I added this:

 

$ch = curl_init("http://192.168.2.249");
$fp = fopen("MainMenu.htm", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);
curl_close($ch);
fclose($fp);
?>

 

and it flashes up this for a second,

 

http://www.peninsulafm.com/error22.PNG

 

and then goes to

Not Found

The requested URL /MainMenu.htm was not found on this server. 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...