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

fixing cors issues with the API post endpoint #28

Merged
merged 1 commit into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion daemon/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "daemon"
version = "1.0.2"
version = "1.0.3"
edition = "2021"
repository = "https://github.com/tee8z/noaa-data-pipeline"

Expand Down
2 changes: 1 addition & 1 deletion oracle/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oracle"
version = "1.0.2"
version = "1.0.3"
edition = "2021"
repository = "https://github.com/tee8z/noaa-data-pipeline"

Expand Down
5 changes: 3 additions & 2 deletions oracle/src/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use axum::{
routing::{get, post},
Router,
};
use hyper::Method;
use hyper::{Method, header::{ACCEPT, CONTENT_TYPE}};
use log::info;
use std::sync::Arc;
use tower_http::{
Expand Down Expand Up @@ -103,7 +103,8 @@ pub fn app(app_state: AppState) -> Router {
let serve_dir = ServeDir::new("ui").not_found_service(ServeFile::new(app_state.ui_dir.clone()));
let cors = CorsLayer::new()
// allow `GET` and `POST` when accessing the resource
.allow_methods([Method::GET, Method::POST])
.allow_methods([Method::GET, Method::POST, Method::OPTIONS])
.allow_headers([ACCEPT,CONTENT_TYPE])
// allow requests from any origin
.allow_origin(Any);
Router::new()
Expand Down