[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[RESUELTO][OT] OOpenlayer dudas generales





El 04/05/12 18:31, Camaleón escribió:
El Fri, 04 May 2012 10:39:39 -0400, islanis escribió:

Camaleón<noelamac@gmail.com>  escribió:

El Fri, 04 May 2012 09:29:38 -0400, islanis escribió:

Alguien ha trabajado con openlayer tengo algunas dudas que quiero
aclarrar,mi gran dudaes como configurar el proxy.cgi en mi  servidor
web
Esto es lo que pone en su FAQ, a ver si te da alguna pista:
(...)

- How do I set up a ProxyHost?

An example proxy host script is available here:
trunk/openlayers/examples/ proxy.cgi
ya lo conseguí y lo puse en practica pero no funciona
¿Qué significa "no funciona"? ¿Has cargado la página y qué te aparece?
¿Has revisado los registros de error de Apache y qué te dicen?

For the standard Apache configuration, you would place proxy.cgi into
your /usr/lib/cgi-bin/ directory.

Once a proxy host script has been installed, you must then edit the
OpenLayers.ProxyHost variable to match that URL.

Given the above standard Apache configuration:

     OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";

If you have done something like this, you should be able to visit:

      http://YourDomain.example.com/cgi-bin/proxy.cgi
Esta es la parte que no entiendo , me parece que hay que tocar algunas
otras cosas, es que de entrada como lo estoy probando en mi misma pc lo
que pongo es
¿Qué es lo que pones? :-)

debo pensar entonces que localhost=YourDomain.example.com o como es?
Las instrucciones dan por hecho que tienes el Apache bien configurado y
por ende, que tienes un alias creado al directorio "/cgi-bin" por lo que
si este es tu caso tienes que poner tal y como indican, cargar la página
web y debería funcionar.

"YourDomain.example.com" tienes que sustituirlo -obviamente- por el
equipo donde tengas configurado el Apache, aunque seguramente te funcione
poniendo la ip local o "localhost" si lo ejecutas desde el mismo equipo
donde tienes el Apache ("http://192.168.0.1/cgi-bin/proxy.cgi"; o "http://
localhost/cgi-bin/proxy.cgi").

Saludos,

ya pude dar con lo que era era unas lineas de codigo en el proxy.cgi, y las cambie y ya me funciona, es cambiar lo que dice http://www.openlayers.org por http://localhost y bueno agregarle a allowedHosts los dos nuevos permitidos , es decir , es jugar con esos datos , gracias a todos










#!/usr/bin/env python -u


"""This is a blind proxy that we use to get around browser
restrictions that prevent the Javascript from loading pages not on the
same server as the Javascript.  This has several problems: it's less
efficient, it might break some sites, and it's a security risk because
people can use this proxy to browse the web and possibly do bad stuff
with it.  It only loads pages via http and https, but it can load any
content type. It supports GET and POST requests."""

import urllib2
import cgi
import sys, os

# Designed to prevent Open Proxy type stuff.

allowedHosts = ['www.openlayers.org', 'openlayers.org',
                'labs.metacarta.com', 'world.freemap.in',
                'prototype.openmnnd.org', 'geo.openplans.org',
                'sigma.openplans.org', 'demo.opengeo.org',
                'www.openstreetmap.org', 'sample.azavea.com',
                'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080',
                'vmap0.tiles.osgeo.org', 'www.openrouteservice.org',
                'localhost', 'localhost:8080']

method = os.environ["REQUEST_METHOD"]

if method == "POST":
    qs = os.environ["QUERY_STRING"]
    d = cgi.parse_qs(qs)
    if d.has_key("url"):
        url = d["url"][0]
    else:
        url = "http://www.openlayers.org";
else:
    fs = cgi.FieldStorage()
    url = fs.getvalue('url', "http://www.openlayers.org";)

try:
    host = url.split("/")[2]
    if allowedHosts and not host in allowedHosts:
        print "Status: 502 Bad Gateway"
        print "Content-Type: text/plain"
        print
print "This proxy does not allow you to access that location (%s)." % (host,)
        print
        print os.environ

    elif url.startswith("http://";) or url.startswith("https://";):

        if method == "POST":
            length = int(os.environ["CONTENT_LENGTH"])
            headers = {"Content-Type": os.environ["CONTENT_TYPE"]}
            body = sys.stdin.read(length)
            r = urllib2.Request(url, body, headers)
            y = urllib2.urlopen(r)
        else:
            y = urllib2.urlopen(url)

        # print content type header
        i = y.info()
        if i.has_key("Content-Type"):
            print "Content-Type: %s" % (i["Content-Type"])
        else:
            print "Content-Type: text/plain"
        print

        print y.read()

        y.close()
    else:
        print "Content-Type: text/plain"
        print
        print "Illegal request."

except Exception, E:
    print "Status: 500 Unexpected Error"
    print "Content-Type: text/plain"
    print
    print "Some unexpected error occurred. Error text was:", E

--

Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/


Reply to: