Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hphy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
向怀芳
hphy
Commits
6fc91f68
Commit
6fc91f68
authored
Oct 21, 2022
by
向怀芳
🎱
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 代理IP处理01
parent
417f3190
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
0 deletions
+1
-0
WebUtils.java
.../java/cn/sh/stc/sict/cloud/common/core/util/WebUtils.java
+1
-0
No files found.
cloud-common/cloud-common-core/src/main/java/cn/sh/stc/sict/cloud/common/core/util/WebUtils.java
View file @
6fc91f68
...
@@ -196,6 +196,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
...
@@ -196,6 +196,7 @@ public class WebUtils extends org.springframework.web.util.WebUtils {
public
String
getIP
(
ServerHttpRequest
request
)
{
public
String
getIP
(
ServerHttpRequest
request
)
{
HttpHeaders
headers
=
request
.
getHeaders
();
HttpHeaders
headers
=
request
.
getHeaders
();
String
ip
=
headers
.
getFirst
(
"x-forwarded-for"
);
String
ip
=
headers
.
getFirst
(
"x-forwarded-for"
);
log
.
error
(
"getIp.ip = {}"
,
ip
);
if
(
ip
!=
null
&&
ip
.
length
()
!=
0
&&
!
"unknown"
.
equalsIgnoreCase
(
ip
))
{
if
(
ip
!=
null
&&
ip
.
length
()
!=
0
&&
!
"unknown"
.
equalsIgnoreCase
(
ip
))
{
// 多次反向代理后会有多个ip值,第一个ip才是真实ip
// 多次反向代理后会有多个ip值,第一个ip才是真实ip
if
(
ip
.
indexOf
(
","
)
!=
-
1
)
{
if
(
ip
.
indexOf
(
","
)
!=
-
1
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment