From d561b5f18d8c64cc02e56d7c830e4126f36a6bab Mon Sep 17 00:00:00 2001 From: hansonryne Date: Thu, 28 May 2020 17:48:07 -0400 Subject: [PATCH] Add support for AWS X-Forwarded-For overwrite (#21) --- IPRotate.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/IPRotate.py b/IPRotate.py index d63434b..9310477 100644 --- a/IPRotate.py +++ b/IPRotate.py @@ -99,7 +99,11 @@ def startAPIGateway(self): restApiId=self.create_api_response['id'], resourceId=get_resource_response['items'][0]['id'], httpMethod='ANY', - authorizationType='NONE' + authorizationType='NONE', + requestParameters={ + 'method.request.path.proxy':True, + 'method.request.header.X-My-X-Forwarded-For':True + } ) self.awsclient.put_integration( @@ -109,7 +113,11 @@ def startAPIGateway(self): httpMethod='ANY', integrationHttpMethod='ANY', uri=self.getTargetProtocol()+'://'+self.target_host.text + '/', - connectionType='INTERNET' + connectionType='INTERNET', + requestParameters={ + 'integration.request.path.proxy':'method.request.path.proxy', + 'integration.request.header.X-Forwarded-For': 'method.request.header.X-My-X-Forwarded-For' + } ) self.awsclient.put_method( @@ -118,7 +126,8 @@ def startAPIGateway(self): httpMethod='ANY', authorizationType='NONE', requestParameters={ - 'method.request.path.proxy':True + 'method.request.path.proxy':True, + 'method.request.header.X-My-X-Forwarded-For':True } ) @@ -131,7 +140,8 @@ def startAPIGateway(self): uri= self.getTargetProtocol()+'://'+self.target_host.text+'/{proxy}', connectionType= 'INTERNET', requestParameters={ - 'integration.request.path.proxy':'method.request.path.proxy' + 'integration.request.path.proxy':'method.request.path.proxy', + 'integration.request.header.X-Forwarded-For': 'method.request.header.X-My-X-Forwarded-For' } )