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 Issue for Apache #46

Open
ebebbington opened this issue May 30, 2020 · 4 comments
Open

CORs Issue for Apache #46

ebebbington opened this issue May 30, 2020 · 4 comments
Labels
Priority: Low Type: Bug Something isn't working as expected

Comments

@ebebbington
Copy link
Member

ebebbington commented May 30, 2020

When using localhost:8080, we get the below errors when sending a POST to /login and /register

@Guergeiro Also mentioned we get CORs problems when using 127.0.0.1:*

Figure out a solution to this to fix the errors.

Errors (in console)

Access to XMLHttpRequest at 'http://localhost:1667/users' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

actions.js:118 Registration unsuccessful.

xhr.js:175 POST http://localhost:1667/users net::ERR_FAILED
    dispatchXhrRequest @ xhr.js:175
    xhrAdapter @ xhr.js:18
    dispatchRequest @ dispatchRequest.js:40
    Promise.then (async)
    request @ Axios.js:64
    Axios.<computed> @ Axios.js:88
    wrap @ bind.js:11
    eval @ actions.js:108
    register @ actions.js:107
    wrappedActionHandler @ vuex.esm.js:840
    dispatch @ vuex.esm.js:478
    boundDispatch @ vuex.esm.js:361
    eval @ Register.vue?./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue- 
    loader-options:73
    Promise.then (async)
    onSubmit @ Register.vue?./node_modules/babel-loader/lib!./node_modules/vue-loader/lib?? 
    vue-loader-options:72
    submit @ Register.vue?./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader- 
    options!./node_modules/vue-loader/lib??vue-loader-options:44
    invokeWithErrorHandling @ vue.js:1888
    invoker @ vue.js:2219
    original._wrapper @ vue.js:7510

actions.js:119 Uncaught (in promise) TypeError: Cannot read property 'data' of undefined
    at eval (actions.js:119)
@ebebbington ebebbington added the Type: Bug Something isn't working as expected label May 30, 2020
@crookse
Copy link
Member

crookse commented May 30, 2020

Might have to implement the OPTIONS method. I wonder if axios does a preflight check before it does the actual POST.

@Guergeiro
Copy link
Member

I believe, this is something that we need to handle in Drash itself... If we add a simple middleware that accepts any origin, should work, right?

@crookse
Copy link
Member

crookse commented May 30, 2020

That's a good point. Didn't think about that. Could work.

@ebebbington
Copy link
Member Author

@Guergeiro feel free to take this issue on 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Low Type: Bug Something isn't working as expected
Development

No branches or pull requests

3 participants