0

Simple, but not for me...

On my Ubuntu host, I have a Geoserver instance listening on port 8080:

   http://<hostname>:8080/geoserver

What I want to achieve is to let clients reach Geoserver through an alias:

   http://<hostname>/geoserver

and I must do it via PHP5 (no Apache tricks).

I guess what I need is an HTTP PHP Proxy.

Example:

#Client asks for  http://<hostname>/geoserver/wms?param1=x&param2=y&param3=z&...
#Proxy intercepts the request
#Proxy asks for http://<hostname>:8080/geoserver/wms?param1=x&param2=y&param3=z&... (with the same headers and body of the client's original request)
#Geoserver sends response to the Proxy
#Proxy forwards the response - as is - to the client

Does anyone know a simple PHP library/solution to solve this issue? Many solutions exist but I've not been able to find out a simple one, so far

Thank you

csparpa
  • 511
  • 2
  • 7
  • 19
  • Why don't you simply run that Geoserver on port 80? – N.B. May 30 '13 at 13:00
  • Unfortunately, I can't. This would really have solved my problem in one shot!!! And also I cannot modifiy the Apache config in order to implement a proxy rule :-( – csparpa May 30 '13 at 13:03
  • So.. you do have something running on port 80 on the machine in question? – N.B. May 30 '13 at 13:04
  • Yes, I have Apache 2.2, which is actually serving my webapp. HTTP requests to Geoserver are done by the client-side Javascript of the webapp and point to 'http:///geoserver'. Unfortunately I can't access port 8080 from the client side (I can only access port 80)...this is why I need a HTTP proxy – csparpa May 30 '13 at 13:09
  • Well, if port 80 is already taken by Apache, you can't solve the problem because Apache listens on that one, which won't let PHP do the same. Having said that, why not simply create an Apache vhost such as `http://geoserver.hostname.com` which proxies to port 8080 internally? – N.B. May 30 '13 at 13:12
  • Maybe this [Geoserver Proxy module] (http://geoserver.org/display/GEOS/GeoServer+Proxy+Extension) can help... – csparpa May 30 '13 at 13:13
  • That doesn't solve anything, it proxies further. You still need to reach it, which you do via 8080. What you need is to talk to port 80, which is handled by Apache. If you can't add new vhosts to Apache, you don't really have much choice there sadly. – N.B. May 30 '13 at 13:18
  • @N.B. I don't think it is impossible to accomplish my goal...a couple of months ago, I wrote the very same thing in Python: a WSGI proxy that runs on Apache, listens on port 80 and forwards requests from clients to a server running on a LAN host and listening on a port other than 80... That said - let's get back to my original question: what I'm asking about is a hint about any PHP library/class that can allow me to solve the problem easily!!! – csparpa May 31 '13 at 07:46
  • Thing is, you have apache on port 80 and it's bound there and listening. Any other program that attempts to listen and bind on port 80 on the same network interface will produce an error. That's why I'm saying that it's not possible to run a PHP socket server there, it won't even start. – N.B. May 31 '13 at 07:53
  • However, there are different strategies you can employ. The easiest one would be creating Apache vhost that just proxies everything to :8080, and even if you don't have access to Apache itself, maybe you could ask the server administrator to do it? – N.B. May 31 '13 at 08:04

0 Answers0