yes i edited web.xml and not server.xml. 
Server.xml is n C:/tomcat7.0/conf and i didn't touch it

i added context.xml that contain this:
<Context antiResourceLocking="false" privileged="true" useHttpOnly="true" /> 
in the folder where is my application

when i go on proxy.cgi i can read all the content as a text :(
"
!C:/Python27/python.exe -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: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 "

> Subject: Re: Problem With proxi.cgi
> To: users@tomcat.apache.org
> From: ma...@apache.org
> Date: Tue, 19 Jan 2016 14:44:40 +0000
> 
> On 19/01/2016 14:32, Luciano Martin Galletti wrote:
> > I’m tryng to use a proxy.cgi for my app developed in openlayer.
> > 
> > 
> > But when i try to use the url of the cgi i can read the test of the file 
> > proxy.cgi and it’s not executed.
> > 
> > 
> > I’ve modified the server.xml adding:
> 
> That should be web.xml for your application.
> 
> > 
> > 
> >     <servlet>
> >         <servlet-name>cgi</servlet-name>
> >         
> > <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
> >         <init-param>
> >           <param-name>debug</param-name>
> >           <param-value>0</param-value>
> >         </init-param>
> >         <init-param>
> >           <param-name>cgiPathPrefix</param-name>
> >           <param-value>WEB-INF/cgi</param-value>
> >         </init-param>
> >          <load-on-startup>5</load-on-startup>
> >     </servlet>
> > 
> > 
> > 
> > and:
> > 
> > 
> >     <servlet-mapping>
> >         <servlet-name>cgi</servlet-name>
> >         <url-pattern>/cgi-bin/*</url-pattern>
> >     </servlet-mapping>
> > 
> > 
> > 
> > and i put the proxy.cgi in the folder WEB-INF/cgi of my app! while 
> > server.xml and context.xml in the folder of my application on server.
> 
> You should leave server.xml where Tomcat installs it.
> 
> Application specific context.xml files should be under META-INF
> 
> > in context.xml i’ve added:
> > 
> >   <Context antiResourceLocking="false" privileged="true" useHttpOnly="true" 
> > /> 
> 
> Which context.xml file?
> 
> Mark
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
                                          

Reply via email to