hoplon / castra

HTTP remote procedure call handler for Clojure.
170 stars 25 forks source link

Scaffolded project raises CORS error on localhost #11

Open KrzysiekJ opened 10 years ago

KrzysiekJ commented 10 years ago

Steps to reproduce

lein new hoplon-castra castra-cors-bug
cd castra-cors-bug
boot development
# In other terminal session:
curl http://localhost:8000

What happens

We get

No Origin Header Specified on Cross-Origin Request%

What should happen

We should get the same result which is returned when invoking curl -H 'Origin: http://localhost:8000' http://localhost:8000, i.e.

<!DOCTYPE html>
<html><head><meta charset="utf-8"><script type="text/javascript">window._hoplon_main_css = 'c6f4dce0-0384-11e4-9191-0800200c9a66.css';</script><script type="text/javascript" src="c6f4dce0-0384-11e4-9191-0800200c9a66.js"></script><script type="text/javascript">tailrecursion.hoplon.app_pages._index_DOT_html.hoploninit();</script></head><body></body></html>%
alandipert commented 10 years ago

Thanks for the report. As a workaround, you can modify your scaffold's build.boot such that your :dependencies look like:

  :dependencies '[[tailrecursion/boot.task   "2.2.1"]
                  [tailrecursion/hoplon      "5.10.11" :exclude [tailrecursion/castra]]
                  [tailrecursion/castra "1.2.0"]]

This rolls Castra back to a pre-CORS version.