@@ -783,8 +783,13 @@ def _start_session(self, user: str, password: str, decode_b64: bool = False, nam
783
783
raise ValueError (f"No response returned from URL: '{ self ._auth_url } '. "
784
784
f"Please double check your address and port number in the URL." )
785
785
786
-
787
786
finally :
787
+ # If the TM1 REST API is routed through a reverse proxy that alters the expected URL,
788
+ # we explicitly re-set the 'TM1SessionId' cookie to maintain session continuity.
789
+ session_id = self ._s .cookies .pop ('TM1SessionId' , None )
790
+ if session_id is not None :
791
+ self ._s .cookies .set ('TM1SessionId' , session_id )
792
+
788
793
# After we have session cookie, drop the Authorization Header
789
794
self .remove_http_header ('Authorization' )
790
795
@@ -917,7 +922,8 @@ def verify_response(response: Response):
917
922
918
923
@staticmethod
919
924
def _build_authorization_token (user : str , password : str , namespace : str = None , gateway : str = None ,
920
- cam_passport : str = None , verify : bool = False , cert : Optional [Union [str , Tuple [str , str ]]] = None ) -> str :
925
+ cam_passport : str = None , verify : bool = False ,
926
+ cert : Optional [Union [str , Tuple [str , str ]]] = None ) -> str :
921
927
""" Build the Authorization Header for CAM and Native Security
922
928
"""
923
929
if cam_passport :
@@ -929,7 +935,8 @@ def _build_authorization_token(user: str, password: str, namespace: str = None,
929
935
930
936
@staticmethod
931
937
def _build_authorization_token_cam (user : str = None , password : str = None , namespace : str = None ,
932
- gateway : str = None , verify : bool = False , cert : Optional [Union [str , Tuple [str , str ]]] = None ) -> str :
938
+ gateway : str = None , verify : bool = False ,
939
+ cert : Optional [Union [str , Tuple [str , str ]]] = None ) -> str :
933
940
if gateway :
934
941
try :
935
942
HttpNegotiateAuth
0 commit comments