Skip to content

Commit

Permalink
Add support for AWS X-Forwarded-For overwrite (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
hansonryne authored May 28, 2020
1 parent 9cf7aee commit d561b5f
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions IPRotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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
}
)

Expand All @@ -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'
}
)

Expand Down

0 comments on commit d561b5f

Please sign in to comment.