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

how to set cors or allowed methods? #203

Closed
jumtp opened this issue May 17, 2023 · 4 comments
Closed

how to set cors or allowed methods? #203

jumtp opened this issue May 17, 2023 · 4 comments

Comments

@jumtp
Copy link

jumtp commented May 17, 2023

I don't know how to set cros, Allowed method & headers. I found a crate but it doesn't work anymore, the code can't be compiled. https://github.com/ntex-rs/ntex-extras/tree/master/ntex-cors. Then I found another crate. https://crates.io/crates/clia-ntex-cors-mod It worked. But not official website certification. Is there any way and solution ?

Below is what I try to do but it doesn't work.
image

cargo.toml
image

@leon3s
Copy link
Member

leon3s commented May 17, 2023

Hey, add this in your Cargo.toml to have the official version.

[patch.crates-io]
ntex-cors = { git = "https://github.com/ntex-rs/ntex-extras.git" }

Then it's been used as a middleware for example:

web::HttpServer::new(move || {
    web::App::new()
      .wrap(Cors::new().finish())
  });

If you add me on the package admin list @fafhrd91 i can update it on crates.io

@fafhrd91
Copy link
Member

@leon3s you should be able to publish ntex-cors

@leon3s
Copy link
Member

leon3s commented May 17, 2023

I just published it, you should be able to install ntex-cors 0.3.0 from crates.io

Don't forget to take a look at the documentation

@jumtp
Copy link
Author

jumtp commented May 22, 2023

It worked. Thanks for your help

@jumtp jumtp closed this as completed May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants