Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cors error #23

Open
Wellers0n opened this issue Feb 1, 2021 · 5 comments
Open

Cors error #23

Wellers0n opened this issue Feb 1, 2021 · 5 comments
Labels
question Further information is requested

Comments

@Wellers0n
Copy link

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
Copy link
Contributor

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
Copy link
Author

Wellers0n commented Feb 3, 2021

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

my file lein.env:

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

it's ok ?

@Wellers0n
Copy link
Author

Wellers0n commented Feb 3, 2021

it don't work

@Wellers0n
Copy link
Author

Wellers0n commented Feb 3, 2021

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
Copy link
Contributor

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?

@andriosrobert andriosrobert added the question Further information is requested label Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants