Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#31 closed enhancement (fixed)

Alias support for proxy url

Reported by: adube Owned by: adube
Priority: major Milestone:
Component: server Version: 0.7
Keywords: proxy, alias, url Cc: adube@…, jlacroix

Description

description

Browsers can only send 4 requests to a same server at a time. An easy way to bypass this limitation is to use aliases. In GeoPrisma, every request goes to the proxy first so there's only and always on point access to every services and it's via the proxy.

issue

Currently, in GeoPrisma, there's only one url for the proxy.

solution

Have as many as we want. We could :

  • have a new "addProxyURL" function to add the url to an array
  • change "setProxyURL" to use "addProxyURL" and use the array
  • change "getProxyURL" to return only the first element of the proxy array (for backward compatibility"
  • hav a new "getProxyURLs" function to return all urls

Attachments (2)

patch-GeoPrisma-31-r736-A0.diff (8.1 KB ) - added by adube 15 years ago.
patch-GeoPrisma-31-r736-A1.diff (8.2 KB ) - added by adube 15 years ago.

Download all attachments as: .zip

Change History (12)

by adube, 15 years ago

comment:1 by adube, 15 years ago

With the patch, a new "setter" is now available : setProxyURLAliases. The use of setProxyURL is still mandatory and must be the same servername as the application :

// MANDATORY
org_geoprisma_SettingImpl::setProxyURL(dirname($_SERVER['PHP_SELF']).'proxy.php');

// OPTIONAL, if you wish to use aliases
$objArrayGeoPrismaProxyURLAliases = array();
$objArrayGeoPrismaProxyURLAliases[] = 'http://www2.myserver.com/proxy.php';
$objArrayGeoPrismaProxyURLAliases[] = 'http://www3.myserver.com/proxy.php';
$objArrayGeoPrismaProxyURLAliases[] = 'http://www4.myserver.com/proxy.php';
$objArrayGeoPrismaProxyURLAliases[] = 'http://www5.myserver.com/proxy.php';
org_geoprisma_SettingImpl::setProxyURLAliases($objArrayGeoPrismaProxyURLAliases);

The aliases are used by the WMS and TileCache service types only.

comment:2 by adube, 15 years ago

Owner: set to adube
Status: newassigned

by adube, 15 years ago

comment:3 by adube, 15 years ago

Resolution: fixed
Status: assignedclosed

The lastest patch passed the php code sniffer tests with 0 errors and was committed : r737 . The documentation of this new feature should appear in the "Optimization" incoming topic soon.

comment:4 by yvesm, 14 years ago

Subdomains should be specifyable as a conifg option in the service so as to mimick http://trac.osgeo.org/openlayers/wiki/OpenLayersOptimization#multipleURLs. I am not reopening the point at this point. Only when we are ready to do something about the problem.

comment:5 by adube, 14 years ago

Let me explain the original problem in more details :

A browser can only send 4 request to a single host at a time. In a OpenLayers application, you can bypass this issue by specifying aliases for hosts used to access the layers.

In GeoPrisma, the only point of entry is proxy.php. Service hosts are not available and are never used by the browser directly. Each layer point to the proxy, which is responsible of creating the request with the original host on the back-end. So, having multiple service aliases wouldn't make any difference since they would all be accessed by proxy.php anyway. So, that means that whether the number of different services or aliases you have, they all go through the proxy first so there can be only 4 at a time.

The patch committed in this ticket fixed that issue by enabling proxy aliases, so that you can have more than 4 requests sent the proxy at a time.

Are the explanations clear ?

in reply to:  5 comment:6 by yvesm, 14 years ago

Right. I looked at the patch more closely and now I see the proxy url array passed to the OL constructor for WMS and TC objects. But wouldn't there be a way to fill the

$objArrayGeoPrismaProxyURLAliases = array();

in a for loop that would get it's values from something like

<wms> ... <source> http://sub1.biz.com/fcgi-bin/mapserv...,http://sub2.biz.com/fcgi-bin/mapserv...,"..." </source> </wms>

in the configuration file ?

Do I understand the current implementation hardcodes the proxy urls so that needs to be modified per GP installation ? Do I also understand the proxy urls are used for all WMS and TC services ? That is, I can't parallel proxy requests to "real" service urls e.g.

<wms> <name>Local WMS</name> <source> http://sub1.biz.com/fcgi-bin/mapserv...,http://sub2.biz.com/fcgi-bin/mapserv...,"..." </source> </wms>

<wms> <name>External WMS</name> <source> "http://labs.metacarta.com/wms-c/Basic.py","http://monitor.metacarta.com/wms-c/Basic.py" </source> </wms>

That is, do I understand all I can do for now is use one source url with many proxy urls (proxy requests parallelized)? Why not one proxy request to many service urls (service requests parallelized) or many proxy urls to many service urls (proxy and service requests parallelized) ?

There must be something I don't get.

comment:7 by jlacroix, 14 years ago

proxy.php is not a browser so it doesn't suffer from the "maximum 2 parallel connection" limitation. There would not be any performance gain from specifying multiple service sources. They are just aliases of the same machine. However we must specify multiple proxy aliases to get rid of the "maximum 2 parallel connection" limitation we have on the proxy.php.

In short, you only need one source url with many proxy urls. There would be no gain to do it the other way.

comment:8 by jlacroix, 14 years ago

Cc: jlacroix added

in reply to:  7 comment:9 by yvesm, 14 years ago

Thanx for the explanation. But wouldn't still be useful to mention the proxy urls in the config file since they depend on installation-specific domain manipulation ?

Something like :

<wms>
<name>Local WMS</name>
<source>http:/biz.com/fcgi-bin/mapserv...</source>
</wms>

<proxyurls>
<source>http://www2.myserver.com/, http://www3.myserver.com/</source>
</proxyurls>

and those would be appended with the '/proxy.php' string ?

I'm just trying to figure out how those urls could be stated elsewhere than in php code but maybe it's fine to hardcode things on every installation.

comment:10 by jlacroix, 14 years ago

You have to modify your Apache configuration to enable that. It's not really a configuration specific setting, but I agree that it's not a index.php specific setting either. Maybe we could put that in the <application> tag in the new PGSQL config. Or in the <layout> tag. Maybe different layout or application will use different aliases.

Note: See TracTickets for help on using tickets.