From: Jair S. <jsa...@gm...> - 2015-10-08 16:01:41
|
Thanks Julian. The Tomcat option is not really an option at the moment since I will need to start from scratch and there is another learning curve. Cheers. JJ. -----Original Message----- From: Julian Hollingbery [mailto:ju...@no...] Sent: Wednesday, October 07, 2015 11:07 PM To: Jair Santos <jsa...@gm...>; 'GeoServer Mailing List List' <geo...@li...> Subject: SV: [Geoserver-users] How to deal with XMLHttpRequest in Geoserver? Hi Jair, Sorry, I have no experience modifying a Jetty setup. My only suggestion is that you check the logs and work from there. Otherwise, consider moving to a setup based on Tomcat. /julian -----Oprindelig meddelelse----- Fra: Jair Santos [mailto:jsa...@gm...] Sendt: 8. oktober 2015 00:19 Til: 'GeoServer Mailing List List' Emne: Re: [Geoserver-users] How to deal with XMLHttpRequest in Geoserver? Hi Julian, I am getting more confused about this. I am trying to follow the instructions from http://wiki.eclipse.org/Jetty/Feature/Cross_Origin_Filter , but it is still not working. I didn't have jetty under C:\Program Files\GeoServer\webapps\geoserver\WEB-INF\lib, so I copied the files jetty-6.1.8.jar and jetty-util-6.1.8.jar from C:\Program Files\GeoServer\lib. Then I included in C:\Program Files\GeoServer\webapps\geoserver\WEB-INF\web.xml the lines <filter-mapping> <filter-name>cross-origin</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> I rebooted the server just in case, and then geoserver stopped working. The service geoserver was still running but when I go to the browser with http://localhost:8080/geoserver/web/ I get http error 503. Any comments will be appreciated. Thanks. JJ. -----Original Message----- From: Julian Hollingbery [mailto:ju...@no...] Sent: Tuesday, October 06, 2015 11:24 PM To: 'GeoServer Mailing List List' <geo...@li...> Subject: Re: [Geoserver-users] How to deal with XMLHttpRequest in Geoserver? Aha, in that case, you are running GeoServer inside a Jetty server which is located at something like C:\Program Files (x86)\GeoServer 2.7.0 Somewhere in here is where you need to make the modification. I have not tried this myself, but from http://wiki.eclipse.org/Jetty/Feature/Cross_Origin_Filter, I am guessing that you need to modify C:\Program Files (x86)\GeoServer 2.7.0\webapps\geoserver\WEB-INF\web.xml Good luck, /julian -----Oprindelig meddelelse----- Fra: Jair Santos [mailto:jsa...@gm...] Sendt: 6. oktober 2015 22:33 Til: 'GeoServer Mailing List List' Emne: Re: [Geoserver-users] How to deal with XMLHttpRequest in Geoserver? Sorry, I downloaded the windows installer NOT the windows binary. Thanks. JJ. -----Original Message----- From: Jair Santos [mailto:jsa...@gm...] Sent: Tuesday, October 6, 2015 1:12 PM To: 'GeoServer Mailing List List' <geo...@li...> Subject: RE: [Geoserver-users] How to deal with XMLHttpRequest in Geoserver? Well, I downloaded the windows binary and installed geoserver as a windows service using the wizard with default settings. Right now I am creating an openlayers app that is running as the default (port 80) web site in the same server. This openlayer web app is trying to access geoserver with: new ol.layer.Vector({ source: new ol.source.Vector({ url: 'http:// 174.5.61.148:8080/geoserver/geid_ws/kml?layers=geid_ws:bmid-parcels', format: new ol.format.KML() }) }), Isn't that the right way? Thank you. JJ. -----Original Message----- From: Julian Hollingbery [mailto:ju...@no...] Sent: Tuesday, October 6, 2015 12:43 PM To: 'GeoServer Mailing List List' <geo...@li...> Subject: Re: [Geoserver-users] How to deal with XMLHttpRequest in Geoserver? In that case, I'd guess that you are not running GeoServer inside that IIS? Regards, /julian ________________________________________ Fra: Jair Santos [jsa...@gm...] Sendt: 6. oktober 2015 17:15 Til: 'GeoServer Mailing List List' Emne: Re: [Geoserver-users] How to deal with XMLHttpRequest in Geoserver? Thank you Julian, I did exactly that. So the configuration in the server is rather simple. I've just included a line in the webconfig file , that is <system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="*" /> </customHeaders> </httpProtocol> </system.webServer> It made no difference whatsoever. Then I realized that this change will make IIS send the header, and in my case it is Geoserver that will format and send the response not IIS. The openlayer program is calling Geoserver with 'http:// 174.5.61.148:8080/geoserver/geid_ws/kml?layers=geid_ws:bmid-parcels'. I am really confused about how this work even after reading the tutorial and examples of CORS. JJ. -----Original Message----- From: Julian Hollingbery [mailto:ju...@no...] Sent: Tuesday, October 6, 2015 1:53 AM To: 'GeoServer Mailing List List' <geo...@li...> Subject: Re: [Geoserver-users] How to deal with XMLHttpRequest in Geoserver? Hi Jair, CORS has nothing directly to do with GeoServer, since GeoServer runs inside an application server. If I read you correctly, and you are running GeoServer inside IIS, then you need to find out how to configure CORS on IIS. I have never done this myself, but Googling "cors on iis8" turns up lots of links which appear to be helpful. Regards, /julian ________________________________________ Fra: Jair Santos [jsa...@gm...] Sendt: 6. oktober 2015 01:50 Cc: 'GeoServer Mailing List List' Emne: Re: [Geoserver-users] How to deal with XMLHttpRequest in Geoserver? Hi all, I am returning to this thread since I've been away for a month and the problem was still here waiting for me. I've been trying to create a layer with new ol.layer.Vector({ source: new ol.source.Vector({ url: 'http:// 174.5.61.148:8080/geoserver/geid_ws/kml?layers=geid_ws:bmid-parcels', format: new ol.format.KML() }) }), The server is responding with XMLHttpRequest cannot load http:// 174.5.61.148:8080/geoserver/geid_ws/kml?layers=geid_ws:bmid-parcels. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http:// 174.5.61.148' is therefore not allowed access. If I understood well geoserver itself will have to format the response including a header containing Access-Control-Allow-Origin = http:// 174.5.61.148:80. Am I right? I truly believe that there is another solution (other than setup a proxy as suggested by Stefano) but unfortunately I couldn't find out. My environment is MS Server 2012, IIS 8, Geoserver 2.7.1.1 Any help will be very much appreciated. TIA JJ. From: Stefano Costa [mailto:ste...@ge...] Sent: Tuesday, September 1, 2015 10:30 AM To: Jair Santos <jsa...@gm...> Cc: GeoServer Mailing List List <geo...@li...> Subject: Re: [Geoserver-users] How to deal with XMLHttpRequest in Geoserver? Hi Jair, CORS is something that you configure on the server side, wrapping the request client-side is not going to take you anywhere. I don't know what your environment is, but if you happen to be running GeoServer on Tomcat 7, this StackOverflow question might help you: http://stackoverflow.com/questions/22363192/cors-tomcat-geoserver Another option you have is to setup a proxy on the machine where your web app is deployed, e.g. using Apache HTTPD. Also this neat little open source project from the company I work for (GeoSolutions) might be worth a look: https://github.com/geosolutions-it/http-proxy. On Tue, Sep 1, 2015 at 6:05 PM, Jair Santos <jsa...@gm...<mailto:jsa...@gm...>> wrote: Hello all, I wondering if someone could help me with the following. I am creating layers with new ol.layer.Vector({ source: new ol.source.Vector({ url: 'http://174.5.61.148:8080/geoserver/geid_ws/kml?layers=geid_ws:pzones', format: new ol.format.KML() }) }), I am getting the following error: "XMLHttpRequest cannot load http:// 174.5.61.148:8080/geoserver/geid_ws/kml?layers=geid_ws:prv_stns. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http:// 174.5.61.148' is therefore not allowed access." This means that Geoserver is not returning the proper "Access-Control-Allow-Origin" in the response. Therefore I have to deal with CORS (Cross Origin Resource Sharing). Basically I have to embed the geoserver request in a javascript code such as function createCORSRequest(method, url) { var xhr = new XMLHttpRequest(); ..... Where url = http:// 174.5.61.148:8080/geoserver/geid_ws/kml?layers=geid_ws:prv_stns Any ideas? TIA JJ. ---------------------------------------------------------------------------- -- _______________________________________________ Geoserver-users mailing list Geo...@li...<mailto:Geo...@li...urcefor ge.net> https://lists.sourceforge.net/lists/listinfo/geoserver-users -- Best regards, Stefano Costa == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Dott. Stefano Costa Senior Software Engineer GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- AVVERTENZE AI SENSI DEL D.Lgs. 196/2003 Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003. The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc. ---------------------------------------------------------------------------- -- _______________________________________________ Geoserver-users mailing list Geo...@li... https://lists.sourceforge.net/lists/listinfo/geoserver-users ---------------------------------------------------------------------------- -- _______________________________________________ Geoserver-users mailing list Geo...@li... https://lists.sourceforge.net/lists/listinfo/geoserver-users ---------------------------------------------------------------------------- -- _______________________________________________ Geoserver-users mailing list Geo...@li... https://lists.sourceforge.net/lists/listinfo/geoserver-users ---------------------------------------------------------------------------- -- _______________________________________________ Geoserver-users mailing list Geo...@li... https://lists.sourceforge.net/lists/listinfo/geoserver-users ---------------------------------------------------------------------------- -- Full-scale, agent-less Infrastructure Monitoring from a single dashboard Integrate with 40+ ManageEngine ITSM Solutions for complete visibility Physical-Virtual-Cloud Infrastructure monitoring from one console Real user monitoring with APM Insights and performance trend reports Learn More http://pubads.g.doubleclick.net/gampad/clk?id=247754911&iu=/4140 _______________________________________________ Geoserver-users mailing list Geo...@li... https://lists.sourceforge.net/lists/listinfo/geoserver-users ---------------------------------------------------------------------------- -- Full-scale, agent-less Infrastructure Monitoring from a single dashboard Integrate with 40+ ManageEngine ITSM Solutions for complete visibility Physical-Virtual-Cloud Infrastructure monitoring from one console Real user monitoring with APM Insights and performance trend reports Learn More http://pubads.g.doubleclick.net/gampad/clk?id=247754911&iu=/4140 _______________________________________________ Geoserver-users mailing list Geo...@li... https://lists.sourceforge.net/lists/listinfo/geoserver-users |