Skip to content

如何限定请求地址? #124

Answered by maslow
Penggeor asked this question in Feedbacks
Discussion options

You must be logged in to vote

目前有一个需求,是从前端请求某个laf云函数,需要在该云函数中限定请求的地址,比如只有来自example.com或者example.cn的请求才会被继续处理,请问应该如何实现?

在云函数中可以获取 http header,可以获取到请求源(若存在): "referer": "https://www.lafyun.com/"

console.log(ctx.headers)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by maslow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants