Issue with custom domain
svdgraaf opened this issue · 0 comments
svdgraaf commented
I've hit an issue when using a custom domain implementation.
When api gateway is setup with a subpath (eg my-custom-domain.com/v1/[resource]
), the request will be different, and contain the /v1/ as part of the request, eg:
{
'resource': '/foobar',
'path': '/v1/foobar',
'httpMethod': 'GET',
'headers': {
'Accept': 'application/json',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.9,nl;q=0.8',
'CloudFront-Forwarded-Proto': 'https',
'CloudFront-Is-Desktop-Viewer': 'true',
'CloudFront-Is-Mobile-Viewer': 'false',
'CloudFront-Is-SmartTV-Viewer': 'false',
'CloudFront-Is-Tablet-Viewer': 'false',
'CloudFront-Viewer-Country': 'NL',
'Host': 'api.foobar.com',
'Referer': 'https://api.foobar.com/v1/docs/',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36',
'Via': '2.0 64150aec025f89247bcddad7c210f6cb.cloudfront.net (CloudFront)',
'X-Amz-Cf-Id': 'jbPh8cdSTAyR6SgVM8txu9WS8PphI29OP2hmQOZ0IvJ0ssW8fcQJbQ==',
'x-amz-date': '20180406T135655Z',
'x-amz-security-token': '',
'X-Amzn-Trace-Id': 'Root=1-5ac77ca7-111b160ce4b39b7608425954',
'X-Forwarded-For': '185.40.99.134, 54.239.167.86',
'X-Forwarded-Port': '443',
'X-Forwarded-Proto': 'https'
},
'queryStringParameters': None,
'pathParameters': None,
'stageVariables': None,
'requestContext': {
'resourceId': 'x5thtq',
'resourcePath': '/foobar',
'httpMethod': 'GET',
'extendedRequestId': 'E7BqIHrWjoEFjQg=',
'requestTime': '06/Apr/2018:13:56:55 +0000',
'path': '/v1/foobar',
'accountId': '618537606105',
'protocol': 'HTTP/1.1',
'stage': 'production',
'requestTimeEpoch': 1523023015228,
'requestId': '5d943842-39a2-11e8-837d-d57bd205b928',
'identity': {
'cognitoIdentityPoolId': None,
'accountId': '618537606105',
'cognitoIdentityId': None,
'caller': 'AROAJ4QGV6BHJ4WTSGWQK:AssumeRoleSession',
'sourceIp': '185.40.99.134',
'accessKey': 'ASIAIPZBIISXIHIAC4EA',
'cognitoAuthenticationType': None,
'cognitoAuthenticationProvider': None,
'userArn': 'arn:aws:sts::1234:assumed-role/awefsdasdfcom/AssumeRoleSession',
'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36',
'user': 'AROAJ4QGV6BHJ4WTSGWQK:AssumeRoleSession'
},
'apiId': 'dil4b1umf1'
},
'body': None,
'isBase64Encoded': False
}
I'll see if I can make a PR and fix this