Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
Paul-Christian Volkmer
ARSnova Backend
Commits
6ba81fca
Commit
6ba81fca
authored
10 years ago
by
Daniel Gerhardt
Browse files
Options
Downloads
Patches
Plain Diff
Fix redirection behind a proxy server
parent
374d7563
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/thm/arsnova/controller/LoginController.java
+11
-6
11 additions, 6 deletions
src/main/java/de/thm/arsnova/controller/LoginController.java
with
11 additions
and
6 deletions
src/main/java/de/thm/arsnova/controller/LoginController.java
+
11
−
6
View file @
6ba81fca
...
...
@@ -235,15 +235,20 @@ public class LoginController extends AbstractController {
failureUrl
=
"/"
;
}
/* Workaround until a solution is found to do a redirect which is
* relative to the server root instead of the context path */
String
port
;
String
serverUrl
=
request
.
getScheme
()
+
"://"
+
request
.
getServerName
();
/* Handle proxy
* TODO: It might be better, to support the proposed standard: http://tools.ietf.org/html/rfc7239 */
int
port
=
""
.
equals
(
request
.
getHeader
(
"X-Forwarded-Port"
))
?
Integer
.
valueOf
(
request
.
getHeader
(
"X-Forwarded-Port"
))
:
request
.
getServerPort
();
if
(
"https"
.
equals
(
request
.
getScheme
()))
{
port
=
443
!=
request
.
getServerPort
()
?
":"
+
request
.
getLocalPort
()
:
""
;
if
(
443
!=
port
)
{
serverUrl
=
serverUrl
+
":"
+
String
.
valueOf
(
port
);
}
}
else
{
port
=
80
!=
request
.
getServerPort
()
?
":"
+
request
.
getLocalPort
()
:
""
;
if
(
80
!=
port
)
{
serverUrl
=
serverUrl
+
":"
+
String
.
valueOf
(
port
);
}
}
String
serverUrl
=
request
.
getScheme
()
+
"://"
+
request
.
getServerName
()
+
port
;
request
.
getSession
().
setAttribute
(
"ars-login-success-url"
,
serverUrl
+
successUrl
);
request
.
getSession
().
setAttribute
(
"ars-login-failure-url"
,
serverUrl
+
failureUrl
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment