Klo*_*ose 2 amazon-web-services aws-lambda aws-api-gateway api-gateway
我的 Lambda 函数返回 html 页面。我能够从 Node js 10.x 成功返回完整的 html。因此,如果我使用 api gateway url https://2kiz3ttah.execute-api.eu-west-1.amazonaws.com/stage/login访问我的 lambda ,如果未登录,则 lambda 应返回重定向 URL。如何返回在浏览器中打开的 URL,而不是呈现 HTML 页面。
在 Lambda 中,您只需返回以下内容:
{
'statusCode': 302,
'headers': {
'Location': 'https://redirect.example.com/path'
}
}
Run Code Online (Sandbox Code Playgroud)
https://redirect.exaaple.com/path您的路径应重定向到的 URL 在哪里。
如果您的 Lambda 是 API Gateway 内的集成,那么这应该适用于您的 Lambda LAMBDA_PROXY。
更多信息请点击这里。
| 归档时间: |
|
| 查看次数: |
5879 次 |
| 最近记录: |