USGS-CMG / usgs-cmg-portal

do_convert.sh
6 stars 13 forks source link

Enable CORS on geoport.whoi.edu #50

Closed rsignell-usgs closed 9 years ago

rsignell-usgs commented 9 years ago

@kwilcox chatted me: "the portal autoscale won't work until you have CORS enabled on your server. That allows the portal to request JSON from the geoport ncWMS server" Instructions at: http://enable-cors.org/server.html

rsignell-usgs commented 9 years ago

From the information at http://enable-cors.org/server_tomcat.html, it looks like we need to first upgrade the thredds-dev tomcat /usr/local/usgs-dev/tomcat-thredds from tomcat 7.0.29 to at least 7.0.41 and then add these lines to the <tomcat>/conf/web.xml file:

<filter>
  <filter-name>CorsFilter</filter-name>
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>CorsFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>
``
rsignell-usgs commented 9 years ago

@gregpike, would you be able to enable CORS on geoport's tomcat and tomcat-dev?

/usr/local/usgs/tomcat-thredds
/usr/local/usgs-dev/tomcat-thredds
gregpike commented 9 years ago

I'll try to get this done this afternoon. I'll let you know when it's ready for testing.

srstsavage commented 9 years ago

It's also possible to enable CORS in your front end web server without touching Tomcat:

http://enable-cors.org/server_apache.html http://enable-cors.org/server_nginx.html

rsignell-usgs commented 9 years ago

@shane-axiom , this would be a better (higher-level) solution, right? Would this mean we wouldn't have to modify every single tomcat instance?

srstsavage commented 9 years ago

Yeah, it's a lot cleaner/easier to enable on the web server in my experience.

gregpike commented 9 years ago

Sorry for the delay on this; CORS is enabled now.

rsignell-usgs commented 9 years ago

@gregpike , did you enable it on tomcat or on apache, or?

gregpike commented 9 years ago

Enabled in Apache.

kwilcox commented 9 years ago

@gregpike @rsignell-usgs This does not seem to be working. Are you only enabling certain domains?

Not working (your server)

Working (our server)

rsignell-usgs commented 9 years ago

@gregpike , we need this working on geoport.whoi.edu as well as geoport-dev.whoi.edu

gregpike commented 9 years ago

Enabled on dev. Let me know if you have any problems.

kwilcox commented 9 years ago

Verified working, can now autoscale datasets: http://axiomdatascience.com/maps/cmg/#map?lg=9bbb30d1-0cdd-477d-9f04-454dd86c635f&p=proj3857&b=google_hybrid

rsignell-usgs commented 9 years ago

And working in the Cesium-driven Australian National Map now also (this also required CORS). Woo hoo!

4-10-2015 3-16-20 pm