- The
requestContext.path
property always contains the original "real" path, including any configured base path and/or API stage. In other words, if the request had come from a web browser, then therequestContext.path
would be the full URL path in the user's address bar. - The top-level
path
property is identical torequestContext.path
when the request is made to a custom domain, but when the request is made to theexecute-api
URL,path
differs in that it does not contain the API stage.
https://abcdef1234.execute-api.eu-west-1.amazonaws.com/default/foo/bar/
{
"resource": "/{proxy+}",
"path": "/foo/bar/",
"headers": {
"Host": "abcdef1234.execute-api.eu-west-1.amazonaws.com"
},
"pathParameters": {
"proxy": "foo/bar"
},
"requestContext": {
"resourcePath": "/{proxy+}",
"path": "/default/foo/bar/",
"stage": "default"
}
}
{
"resource": "/{proxy+}",
"path": "/foo/bar/",
"headers": {
"Host": "example.com"
},
"pathParameters": {
"proxy": "foo/bar"
},
"requestContext": {
"resourcePath": "/{proxy+}",
"path": "/foo/bar/",
"stage": "default"
}
}
https://example.com/echo/foo/bar/
{
"resource": "/{proxy+}",
"path": "/echo/foo/bar/",
"headers": {
"Host": "example.com"
},
"pathParameters": {
"proxy": "foo/bar"
},
"requestContext": {
"resourcePath": "/{proxy+}",
"path": "/echo/foo/bar/",
"stage": "default"
}
}
https://example.com/default/foo/bar/
{
"resource": "/{proxy+}",
"path": "/default/foo/bar/",
"headers": {
"Host": "example.com"
},
"pathParameters": {
"proxy": "foo/bar"
},
"requestContext": {
"resourcePath": "/{proxy+}",
"path": "/default/foo/bar/",
"stage": "default"
}
}
https://example.com/echo/default/foo/bar/
{
"resource": "/{proxy+}",
"path": "/echo/default/foo/bar/",
"headers": {
"Host": "example.com"
},
"pathParameters": {
"proxy": "foo/bar"
},
"requestContext": {
"resourcePath": "/{proxy+}",
"path": "/echo/default/foo/bar/",
"stage": "default"
}
}