Actix-web: Is there a easy way to handle CORS/OPTIONS?

Created on 5 Jan 2018  路  13Comments  路  Source: actix/actix-web

Most helpful comment

I'll check what I can do.

All 13 comments

What is OPTIONS?

I have plans for cors support, but it is lower priority at the moment

I'M doing a person project. now it use vuejs, I also want to try yew(it's cool). so actix having a "native" built in support CORS would be grate.
..

I'll check what I can do.

@fafhrd91 thank you very much!

@krircc could you explain how CORS/OPTIONS should work from your perspective?

@fafhrd91 my font-end code use vuejs. usually it use node sever in development at port 3000. my backend code use actix sever at port 8088.
in vuejs :

axios.get('http://localhost:8088/api/user_info', auth.getAuthHeader() )

but because CORS .web browsers sending a preflight OPTIONS request asking what resources it is allowed to access on the server, then after being given a resonse containing certain information in it's header a browser will send the actual GET/PUT/POST/etc query to the server, with no response it will not do this and cause Cross Site Scripting errors to be reported.
THERE is an issues in Rocker : Lack of handling for CORS/OPTIONS

thanks, that is useful

@fafhrd91
there is also a good library for rocket-cors
I don't know Is it helpful? I'm a noder. actix is more faster than node frameworks.

I added basic preflight support,

does anyone wants to do more work on cars support? otherwise I will complete it later this week

@fafhrd91 awesome! more and more projects use restful api , even grphaql sever let font-end and backend separation , It's friend for many clients application, now actix-web is the first rust framework friendly support It 馃 .

I think cors support is completed.

@krircc could you test it on your project? also could you maybe add user guide section related to CORS/OPTIONS

@fafhrd91 ok Iwill write a blog in actix website.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Eilie picture Eilie  路  5Comments

gh67uyyghj picture gh67uyyghj  路  3Comments

Dadibom picture Dadibom  路  4Comments

cheolgyu picture cheolgyu  路  3Comments

icommit picture icommit  路  3Comments