Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not a Issue But More of an Feature Request to Allow Wildcard Subdomain #64

Open
BitThr3at opened this issue Jul 27, 2024 · 0 comments
Open

Comments

@BitThr3at
Copy link

First of all thanks mate for developing and maintaining such a good extension, i want to know it is possible to allow rotating traffic for *.example.com ?

i tried doing it in following way but failed and since you have better idea of the code and also as it is written in python2 i thought it would right to get advice from you.

  1. create a subdomain variable with default value "www"
			self.deploy_response = self.awsclient.create_deployment(
				restApiId=self.restAPIId,
				stageName=STAGE_NAME,
				variables={
    			    'subdomain': 'www'  
    			}
		
			)
  1. use the variable in integration
			self.awsclient.put_integration(
				restApiId=self.create_api_response['id'],
				resourceId=get_resource_response['items'][0]['id'],
				type='HTTP_PROXY',
				httpMethod='ANY',
				integrationHttpMethod='ANY',
				uri=self.getTargetProtocol()+'://${stageVariables.subdomain}'+ '/',
				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'
				}
			)
  1. Map the request header value containing subdomain to subdomain variable
			self.awsclient.update_stage(
				restApiId=self.restAPIId,
				stageName=STAGE_NAME,
				patchOperations=[
					{
						'op': 'replace',
						'path': '/variables/subdomain',
						'value': "$input.params('X-My-X-Forwarded-For')"  
					}
				]
			)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant