当你使用cdn的时候,难免会遇到一个问题,就是https如何获取用户的真实ip呢?也就是当你没有后端服务器证书的情况下,纯tcp转发的情况下,如何获取用户的ip地址?
基本思路就是使用 jsonp技术。
如上。
摘自:https://www.ipify.org/
这样就获取到了用户的真实ip地址。
第一次获取后,写入cookie或者提交到后端,写入session中即可~
About the author
Software Developer @golang @react
Comments
Join the discussionNo comments yet. Be the first to comment.