Commit 88445649 authored by 郑磊's avatar 郑磊

增加代理ip解析

parent f002a0d9
...@@ -37,6 +37,17 @@ public class CaptchaController { ...@@ -37,6 +37,17 @@ public class CaptchaController {
) { ) {
var type = getRandomType(); var type = getRandomType();
var ip = request.getRemoteAddr(); var ip = request.getRemoteAddr();
var proxyIp = request.getHeader("x-forwarded-for");
if (proxyIp != null && !proxyIp.isEmpty()) {
ip = proxyIp.split(",")[0].trim();
} else {
proxyIp = request.getHeader("x-real-ip");
if (proxyIp != null && !proxyIp.isEmpty()) {
ip = proxyIp;
}
}
Map<String, Object> extra = null; Map<String, Object> extra = null;
if (data != null) { if (data != null) {
extra = data.getExtra(); extra = data.getExtra();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment