-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no $baseURL set will be notice "The baseURL value must be set" #1476
Comments
I wonder if this is feasible, please enlighten me. |
We do not recommend changing any of the system files (IncomingRequest) in your webapps. The comment for $baseURL inside Config.App already says that CodeIgniter will try to guess this. You say you get an error 500 ... can you elaborate? Do your error logs shed any loght on things? Is this for every page? What is your configuration?Turn off the bolding before doing anything - it hurts the eyes and does serve a useful purpose! :-/ |
The descript is not right, I'm so sorry |
A lot of people will modify the base script to do that automatically, I'm sure. However, we've chosen to force the user to set that for security reasons. That way all URLs that are built with our URL helpers will only use a known value. Eliminates any possibilities of client interference with the URL. |
I see. Thank you. However, for new users, it is not very friendly to prompt for "You have an empty or invalid base URL. The baseURL value must be set in Config\App.php, or through the .env file." for the first time. |
my code
#File:App.php
public $baseURL = '';
it's will be notice
You have an empty or invalid base URL. The baseURL value must be set in Config\App.php, or through the .env file.
So, I modified the page IncomingRequest.php ,Let it automatically get $baseURL.
#File:IncomingRequest.php
#Function detectURI()
#Add Codes in 576line
// baseURL, so let's help them out.
if(empty($baseURL)){
$httpType = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ||
(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
$baseURL = $httpType . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']);
}
It's Ok , hahaha
The text was updated successfully, but these errors were encountered: