@@ -35,8 +35,12 @@ use crate::{
3535 request_context:: RequestContext ,
3636} ;
3737
38+ const X_RIVET_TARGET : HeaderName = HeaderName :: from_static ( "x-rivet-target" ) ;
39+ const X_RIVET_ACTOR : HeaderName = HeaderName :: from_static ( "x-rivet-actor" ) ;
40+ const X_RIVET_TOKEN : HeaderName = HeaderName :: from_static ( "x-rivet-token" ) ;
3841pub const X_FORWARDED_FOR : HeaderName = HeaderName :: from_static ( "x-forwarded-for" ) ;
3942pub const X_RIVET_ERROR : HeaderName = HeaderName :: from_static ( "x-rivet-error" ) ;
43+
4044const ROUTE_CACHE_TTL : Duration = Duration :: from_secs ( 60 * 10 ) ; // 10 minutes
4145const PROXY_STATE_CACHE_TTL : Duration = Duration :: from_secs ( 60 * 60 ) ; // 1 hour
4246const WEBSOCKET_CLOSE_LINGER : Duration = Duration :: from_millis ( 100 ) ; // Keep TCP connection open briefly after WebSocket close
@@ -1060,6 +1064,7 @@ impl ProxyService {
10601064 }
10611065 }
10621066
1067+ /// Modifies the incoming request before it is proxied.
10631068 fn proxied_request_builder (
10641069 & self ,
10651070 req_parts : & hyper:: http:: request:: Parts ,
@@ -1089,13 +1094,16 @@ impl ProxyService {
10891094 . method ( req_parts. method . clone ( ) )
10901095 . uri ( url. to_string ( ) ) ;
10911096
1092- // Add proxy headers
1093- {
1094- let headers = builder
1095- . headers_mut ( )
1096- . expect ( "request builder unexpectedly in error state" ) ;
1097- add_proxy_headers_with_addr ( headers, & req_parts. headers , self . remote_addr ) ?;
1098- }
1097+ // Modify proxy headers
1098+ let headers = builder
1099+ . headers_mut ( )
1100+ . expect ( "request builder unexpectedly in error state" ) ;
1101+
1102+ headers. remove ( X_RIVET_TARGET ) ;
1103+ headers. remove ( X_RIVET_ACTOR ) ;
1104+ headers. remove ( X_RIVET_TOKEN ) ;
1105+
1106+ add_proxy_headers_with_addr ( headers, & req_parts. headers , self . remote_addr ) ?;
10991107
11001108 Ok ( builder)
11011109 }
0 commit comments