[OSGeo-UK] How do you use OpenLayers.ProxyHost?
Matt Walker
walkermatt at longwayaround.org.uk
Tue Mar 15 15:07:46 EDT 2011
Hi Peter,
Have you seen:
http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost ?
It's been a while since I had need to set up a ProxyHost but I think that
OpenLayers appends the complete URL that it is looking to request data from
to the URL specified as the ProxyHost.
Hope that helps,
Matt.
--
Matt Walker
@_walkermatt
On 15 March 2011 13:05, Peter Cotroneo
<Peter.Cotroneo at ordnancesurvey.co.uk>wrote:
> Hi,
>
>
>
> I’m running into a cross-site scripting issue with OpenLayers.loadURL, and
> I’m not sure how to use OpenLayers.ProxyHost. I can’t seem to find any
> documentation that says where to specify this parameter (in JavaScript code,
> a config file, etc.).
>
>
>
> My JavaScript code looks like this:
>
>
>
> *var* uri = "http://46.137.1.44/gazetteer/postcode?q=" + queryText;
>
>
>
> OpenLayers.ProxyHost="proxy.php?q=”+queryText;
>
>
>
> OpenLayers.loadURL(uri, '', *this*, pcInfo, pcFailure);
>
>
>
> And my PHP proxy looks like this:
>
>
>
> <?php
>
> $ IP_ADDRESS = ‘46.137.1.44’;
>
> echo file_get_contents('http://' . $IP_ADDRESS .
> '/gazetteer/postcode?q=' . urlencode($_GET['q']));
>
> ?>
>
>
>
> The proxy is running on a LAMP stack. I’ve used this proxy for a straight
> AJAX call, and it works fine. I’m assuming, then, that I’m using
> OpenLayers.ProxyHost incorrectly.
>
>
>
> Any ideas?
>
>
>
> Cheers,
>
>
>
> Peter
>
> This email is only intended for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email which must not be copied, distributed or disclosed to any other person.
>
> Unless stated otherwise, the contents of this email are personal to the writer and do not represent the official view of Ordnance Survey. Nor can any contract be formed on Ordnance Survey's behalf via email. We reserve the right to monitor emails and attachments without prior notice.
>
> Thank you for your cooperation.
>
> Ordnance Survey
> Adanac Drive
> Southampton SO16 0AS
> Tel: 08456 050505http://www.ordnancesurvey.co.uk
>
>
> _______________________________________________
> UK mailing list
> UK at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/uk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/uk/attachments/20110315/c57f7302/attachment.html
More information about the UK
mailing list