ajanata / PretendYoureXyzzy

A web clone of the card game Cards Against Humanity.
https://pretendyoure.xyz/zy
BSD 2-Clause "Simplified" License
1.23k stars 397 forks source link

Add CORS support #123

Closed Voltasalt closed 8 years ago

Voltasalt commented 9 years ago

This will close #122, and allow other domains to access this API. (So it's possible to make browser clients)

ajanata commented 9 years ago

Looking at the documentation for CorsFilter, it seems like there would still be more work involved to make it accept request originating from any arbitrary site; i.e., that it only sets attributes on the request. Am I mis-reading this documentation, or is there still some work to be done?

Voltasalt commented 9 years ago

@ajanata All it does is add 2 HTTP headers to the response. When JavaScript sends an Ajax request to your server, the browser checks for the headers, and if they aren't there, it won't allow the request. That's all there is to it.

Voltasalt commented 8 years ago

Bump?

ajanata commented 8 years ago

I know this is super old (sorry!) but I'm getting startup errors. I'm going to pull this out as I don't have the cycles to investigate right now.

Tomcat is just ... not starting properly, and Jetty is outright saying it can't find it.

Apr 03, 2016 10:16:30 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Error filterStart Apr 03, 2016 10:16:30 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/zy] startup failed due to previous errors

jdf221 commented 8 years ago

Any update on this?

I don't get any errors when running it.

I could have done something wrong though, as I've never used Eclipse or TomCat. All I did was run mvn clean package war:war in the dir of a download of this repository. Then uploaded the .war to TomCat7 manager.

ajanata commented 7 years ago

I'm not getting errors on a freshly re-installed server, but it's causing Chrome to refuse to work with it via HTTPS (because Chrome sends Origin: for every request, and Tomcat sees that and doesn't like the fact that it sees 'https' on a connection that (to it) was http, as far as I can tell). I've spent more time than I want to fighting with this. I'm going to have to pass on this for now.