- 最新
- 投票最多
- 评论最多
After a few more attempts, I realised I only needed to ensure the lambda function to return status 200 to pass the preflight check of the OPTIONS request, then will auto trigger the POST HTTP API call which solved my issue.
Heya, The issue you are facing is likely due to the way that CORS works. When you enable CORS on an API Gateway, you are essentially telling the API Gateway that it should allow requests from certain origins. However, this does not mean that the API Gateway will automatically pass the body of the request to the Lambda function. The Lambda function will only receive the body of the request if the origin of the request is witelisted in the CORS configuration.
To resolve this issue, you need to add the origin of your Unity3D game to the CORS configuration for your API Gateway. You can do this by following these steps:
Go to the API Gateway console. Click the CORS tab for the API Gateway that you are using. Click the Add Origin button. Enter the origin of your Unity3D game in the Origin field. Click the Save button. Once you have added the origin of your Unity3D game to the CORS configuration, the Lambda function should start receiving the body of the request from your game.
Here are some additional things to check:
Make sure that you have enabled CORS on the API Gateway. Make sure that you have added the origin of your Unity3D game to the CORS configuration. Make sure that the body of the request is in the correct format. Make sure that the Lambda function is configured to handle POST requests.
相关内容
- AWS 官方已更新 2 年前
- AWS 官方已更新 2 年前
Thanks for your reply. After a few more attempts, I realised I only needed to ensure the lambda function to return status 200 to pass the preflight check of the OPTIONS request, then will auto trigger the POST HTTP API call which solved my issue.