Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
92c08c77
Commit
92c08c77
authored
Sep 7, 2015
by
Raphaël Doursenaud
Browse files
Options
Downloads
Patches
Plain Diff
Qual: Don't attempt HTTPS redirect if already using HTTPS
parent
53a9c93b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/main.inc.php
+4
-11
4 additions, 11 deletions
htdocs/main.inc.php
with
4 additions
and
11 deletions
htdocs/main.inc.php
+
4
−
11
View file @
92c08c77
...
@@ -225,7 +225,8 @@ if (isset($_SERVER["HTTP_USER_AGENT"]))
...
@@ -225,7 +225,8 @@ if (isset($_SERVER["HTTP_USER_AGENT"]))
// Force HTTPS if required ($conf->file->main_force_https is 0/1 or https dolibarr root url)
// Force HTTPS if required ($conf->file->main_force_https is 0/1 or https dolibarr root url)
if
(
!
empty
(
$conf
->
file
->
main_force_https
))
// $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
if
(
!
empty
(
$conf
->
file
->
main_force_https
)
&&
(
empty
(
$_SERVER
[
"HTTPS"
])
||
$_SERVER
[
"HTTPS"
]
!=
'on'
))
{
{
$newurl
=
''
;
$newurl
=
''
;
if
(
is_numeric
(
$conf
->
file
->
main_force_https
))
if
(
is_numeric
(
$conf
->
file
->
main_force_https
))
...
@@ -238,23 +239,15 @@ if (! empty($conf->file->main_force_https))
...
@@ -238,23 +239,15 @@ if (! empty($conf->file->main_force_https))
}
}
}
}
else
// Check HTTPS environment variable (Apache/mod_ssl only)
else
// Check HTTPS environment variable (Apache/mod_ssl only)
{
// $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
if
(
empty
(
$_SERVER
[
"HTTPS"
])
||
$_SERVER
[
"HTTPS"
]
!=
'on'
)
// If link is http
{
{
$newurl
=
preg_replace
(
'/^http:/i'
,
'https:'
,
DOL_MAIN_URL_ROOT
)
.
$_SERVER
[
"REQUEST_URI"
];
$newurl
=
preg_replace
(
'/^http:/i'
,
'https:'
,
DOL_MAIN_URL_ROOT
)
.
$_SERVER
[
"REQUEST_URI"
];
}
}
}
}
}
else
else
{
{
// Check HTTPS environment variable (Apache/mod_ssl only)
// Check HTTPS environment variable (Apache/mod_ssl only)
// $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
if
(
empty
(
$_SERVER
[
"HTTPS"
])
||
$_SERVER
[
"HTTPS"
]
!=
'on'
)
// If link is http
{
$newurl
=
$conf
->
file
->
main_force_https
.
$_SERVER
[
"REQUEST_URI"
];
$newurl
=
$conf
->
file
->
main_force_https
.
$_SERVER
[
"REQUEST_URI"
];
}
}
}
// Start redirect
// Start redirect
if
(
$newurl
)
if
(
$newurl
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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