hoophq/sequence

Cors error

Wellers0n opened this issue · 5 comments

I'm with a cors error, can you help me ?

sequence_1  | INFO  io.pedestal.http.cors  - {:msg "cors request processing", :origin "http://localhost:3000", :allowed nil, :line 84}

image

Hey @Wellers0n!

Can you share the request you're trying to make and the response you get?

You can set a list of accepted CORS hosts by setting the environment variable: ALLOWED_ORIGINS

For example, setting: ALLOWED_ORIGINS= '["https://decimals.stoplight.io"]' will allow requests from https://decimals.stoplight.io - you can add a list of origins to this array.

Just added this description to the docs, thanks!

I need putting this in my file lein.env, right ?

my file lein.env:

{
    ALLOWED_ORIGINS='["http://localhost:3000/"]'
}

it's ok ?

it don't work

I'm using this service that accept a request from localhost:3000

(def service-map-new
  {::http/routes i/routes
    ::http/allowed-origins {:allowed-origins ["http://localhost:3000"]
                            :methods "GET,POST"}
    ::http/type   :jetty
    ::http/host   "0.0.0.0"
    ::http/port   8910})

but this don't work in my machine :/

It will help if you share how you are trying to connect to the API.

The logs aren't showing an error, are you trying to access from the browser?