Nginx default hostname "_" forwarded to SSO server
Open
Nobody has claimed this yet.
Enhancement
- Dominant language
- PHP
- Stars
- 798
- Forks
- 419
- PR merge metrics
- No merged PRs in 30d
Description
Default nginx config has a host name of "_"
Diff to support this is:
--- a/source/CAS/Client.php
+++ b/source/CAS/Client.php
@@ -3970,7 +3970,7 @@ class CAS_Client
} else if (!empty($_SERVER['HTTP_X_FORWARDED_SERVER'])) {
$server_url = $_SERVER['HTTP_X_FORWARDED_SERVER'];
} else {
- if (empty($_SERVER['SERVER_NAME'])) {
+ if (empty($_SERVER['SERVER_NAME']) || $_SERVER['SERVER_NAME'] == '_') {
$server_url = $_SERVER['HTTP_HOST'];
} else {
$server_url = $_SERVER['SERVER_NAME'];
Obviously you need to fix the config sample in the examples folder as well:
--- a/docs/examples/config.example.php
+++ b/docs/examples/config.example.php
@@ -63,11 +63,13 @@ $driver_options = '';
///////////////////////////////////////////
// Generating the URLS for the local cas example services for proxy testing
+$sname = (empty($_SERVER['SERVER_NAME']) || $_SERVER['SERVER_NAME']=='_' )?$_SERVER['HOST_NAME']:$_SERVER['SERVER_NAME'];
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
- $curbase = 'https://' . $_SERVER['SERVER_NAME'];
+ $curbase = 'https://' . $sname;
} else {
- $curbase = 'http://' . $_SERVER['SERVER_NAME'];
+ $curbase = 'http://' . $sname;
}
+unset($sname);
if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
$curbase .= ':' . $_SERVER['SERVER_PORT'];
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading source/CAS/Client.php around the server URL selection and docs/examples/config.example.php around the local CAS example URL setup. Compare both paths with the reported nginx hostname value and verify that the generated SSO and example-service URLs use the forwarded host rather than "_"; the issue is done when both affected configurations behave correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nginx, php
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100