File tree 1 file changed +6
-13
lines changed
1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -312,11 +312,6 @@ pub struct ProxyRequest {
312
312
}
313
313
impl ProxyRequest {
314
314
pub async fn new ( hyper_req : & mut Request < Incoming > , state : & State ) -> Option < Self > {
315
- let mut host = get_header ( hyper_req, HOST . as_str ( ) ) ?;
316
- let host_regex = host. clone ( ) ;
317
-
318
- let captures = state. host_regex . captures ( & host_regex) ?;
319
-
320
315
let namespace = state. config . proxy_namespace . clone ( ) ;
321
316
322
317
let protocol = get_header ( hyper_req, UPGRADE . as_str ( ) )
@@ -329,15 +324,13 @@ impl ProxyRequest {
329
324
} )
330
325
. unwrap_or ( Protocol :: Http ) ;
331
326
332
- if let Some ( key) = captures. get ( 1 ) {
333
- let key = key. as_str ( ) ;
334
- hyper_req
335
- . headers_mut ( )
336
- . insert ( DMTR_API_KEY , HeaderValue :: from_str ( key) . unwrap ( ) ) ;
337
- host = host. replace ( & format ! ( "{key}." ) , "" ) ;
338
- }
327
+ let host = get_header ( hyper_req, HOST . as_str ( ) ) ?;
328
+ let captures = state. host_regex . captures ( & host) ?;
329
+
330
+ let token = get_header ( hyper_req, DMTR_API_KEY )
331
+ . or_else ( || captures. get ( 1 ) . map ( |v| v. as_str ( ) . to_string ( ) ) )
332
+ . unwrap_or_default ( ) ;
339
333
340
- let token = get_header ( hyper_req, DMTR_API_KEY ) . unwrap_or_default ( ) ;
341
334
let consumer = state. get_consumer ( & token) . await ?;
342
335
let instance = format ! (
343
336
"ogmios-{}-{}.{}:{}" ,
You can’t perform that action at this time.
0 commit comments