perwendel / spark

A simple expressive web framework for java. Spark has a kotlin DSL https://github.com/perwendel/spark-kotlin
Apache License 2.0
9.64k stars 1.56k forks source link

CORS with external static files #973

Open mrwhy-orig opened 6 years ago

mrwhy-orig commented 6 years ago

I have some CORS problems with static files from applications on different ports. I'm accessing the server via a websocket, and for some images on the server. The websocket is working fine but getting the images results in an CORS error.

abhinavsayan commented 6 years ago

Different ports are different paths. You can either server all the static file (html and images) on the same port. Or enable CROS request for the port serving the images.

This link might be use full.

https://sparktutorials.github.io/2016/05/01/cors.html