Skip to content
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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@

All notable changes to this project will be documented in this file.

## [0.11.6] - 2025-04-04

### 🐛 Bug Fixes

- Backend request authority

## [0.11.5] - 2025-04-03

### 🐛 Bug Fixes

- Mapping store name with db url

### ⚙️ Miscellaneous Tasks

- Release

## [0.11.4] - 2025-04-02

### 🚜 Refactor
Expand Down
16 changes: 8 additions & 8 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2"

[workspace.package]
version = "0.11.5"
version = "0.11.6"
edition = "2021"
publish = false
authors = ["FastEdge Development Team"]
Expand Down
20 changes: 5 additions & 15 deletions crates/http-service/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::{anyhow, Error};
use anyhow::Error;
use dictionary::Dictionary;
use http::request::Parts;
use http::uri::Scheme;
Expand Down Expand Up @@ -71,31 +71,21 @@ impl<C> BackendRequest for HttpState<C> {

headers.extend(self.propagate_headers.clone());

let host = canonical_host_name(&headers, &original_url)?;
let uri = canonical_url(&original_url, &host, self.uri.path())?;

head.uri = uri;
head.headers = headers;

let authority = self
.http_backend
.uri()
.authority()
.map(|a| a.as_str().to_string())
.unwrap_or("localhost:10080".to_string());
let uri = canonical_url(&original_url, &authority, self.uri.path())?;

head.uri = uri;
head.headers = headers;

Ok((authority, head))
}
}

// extract canonical host name
fn canonical_host_name(headers: &HeaderMap, original_uri: &Uri) -> anyhow::Result<String> {
let host = headers.get(header::HOST).and_then(|v| v.to_str().ok());
host.or_else(|| original_uri.host())
.ok_or(anyhow!("Could determine a Host header"))
.map(|h| h.to_string())
}

// make canonical uri for backend
fn canonical_url(
original_url: &Uri,
Expand Down
5 changes: 4 additions & 1 deletion src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ impl ContextT for Context {
}

fn make_key_value_store(&self, stores: &Vec<KvStoreOption>) -> KeyValueStore {
let stores = stores.iter().map(|s| (s.name.clone(), s.param.clone())).collect();
let stores = stores
.iter()
.map(|s| (s.name.clone(), s.param.clone()))
.collect();
KeyValueStore::new(stores, Arc::new(CliStoreManager))
}
}
Expand Down