hoophq / sequence

Immutable, scalable, and easy to use ledger service.
Apache License 2.0
492 stars 31 forks source link

Cors error #23

Open Wellers0n opened 3 years ago

Wellers0n commented 3 years ago

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

andriosrobert commented 3 years ago

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!

Wellers0n commented 3 years ago

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

my file lein.env:

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

it's ok ?

Wellers0n commented 3 years ago

it don't work

Wellers0n commented 3 years ago

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 :/

andriosrobert commented 3 years ago

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?