1

I'm using my localhost geoserver to display the data in webworldwind application (using javascript and html).

I got the error

XMLHttpRequest cannot load http://localhost:8080/geoserver/topp/wms?service=WMS&request=GetCapabilities&version=1.3.0. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.

  1. I solved this issue by add an extension **Allow-Control-Allow-Origin: ** in the chrome
  2. But, I need javascript code for CORS ORIGIN to add in my application instead of the extension i used in browser

I didn't found any solution. I'm drained by searching.

Kaiido
  • 123,334
  • 13
  • 219
  • 285
  • Wait so you parse the WebWorldWin data on your backend then sending it your your client? Cors-origin is typically server related. – Webbanditten Jul 31 '17 at 12:25
  • It depends on whatever is running `http://localhost:8080`, not on your JavaScript/HTML client. – Quentin Jul 31 '17 at 12:30
  • According to [this](https://gis.stackexchange.com/questions/210109/enabling-cors-in-geoserver-jetty/212994) you should have some options in `webapps/geoserver/WEB-INF/web.xml`. But you may also need to set some webworldwind specific options that I can't find (NASA guys...) . One solution that would work however would be to setup a simple proxy from `:80` to `:8080` – Kaiido Jul 31 '17 at 12:33
  • @Quentin allow me to disagree with your mjolnir use : The question at hand doesn't ask **why** it doesn't work, but "*how to make it work within the specific setup *webworldwind + geoserver*.* I ever this question is reopened, please add [[tag:geoserver]] to it. – Kaiido Jul 31 '17 at 12:36
  • is there any possibility to write a code in my application to work this @Kaiido – MohanaKrishnan S Aug 01 '17 at 01:00
  • Certainly yes, but I don't know webworldwind nor GeoServer, and don't have it at hand, nor will I install it only for you (sorry) so I can't tell you exactly what will work and what won't, but did you have a look at [the link I gave to you](https://gis.stackexchange.com/questions/210109/enabling-cors-in-geoserver-jetty/212994) ? Is this setting enough ? Otherwise, you might have to look yourself in webworldwind config files anything about `cross-origin`. – Kaiido Aug 01 '17 at 01:04
  • s i have tried but it didn't work ... i will look in WWW and thq – MohanaKrishnan S Aug 01 '17 at 10:29

0 Answers0