r0man / ring-cors

Ring middleware for Cross-Origin Resource Sharing.
http://github.com/r0man/ring-cors
169 stars 44 forks source link

how to add wasm(WebAssembly)and etc content-type? #32

Open PlumpMath opened 3 years ago

PlumpMath commented 3 years ago

I'm using ring.middleware.cors with unity3d wasm.

error: wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.

warning: HTTP Response Header "Content-Type" configured incorrectly on the server for file Build/MyGame.wasm , should be "application/wasm". Startup time performance will suffer.

(def ring-middle (-> ROUTE/my-route RING-MIDDLEWARE-JSON/wrap-json-body RING-MIDDLEWARE-JSON/wrap-json-response (RING-MIDDLEWARE-DEFAULTS/wrap-defaults RING-MIDDLEWARE-DEFAULTS/site-defaults) (RING-MIDDLEWARE-CORS/wrap-cors :access-control-allow-credentials "true" :access-control-allow-origin [#".*"] :access-control-allow-headers #{"accept" "accept-encoding" "accept-language" "authorization" "content-type" "origin"} ;; I want to add mime-types. "content-type:... "application/wasm br gz javascript" ... etc :access-control-allow-methods [:get :put :post :delete :options]) ))