• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
base_url() and site_url() in CI_3.0.3

#1
Hello, I using site_url method for load css and js file in my app.

[Image: psuloan.png]

and today I up to CI_3.0.3, site_url is not working I can not load css and js file.

now I must set my domain in $config['base_url'] (not empty) and then site_url is working.

my question in CI_3.0.3 is : why site_url is not working and why I must set my domain in $config['base_url'] ?
(in CI_3.0.2 site_url method is working when $config['base_url'] is empty)

sorry, my eng is bad. thank you.
Reply

#2
See Change log: http://www.codeigniter.com/user_guide/changelog.html

> Changed Config Library method base_url() to fallback to $_SERVER['SERVER_ADDR'] when $config['base_url'] is empty in order to avoid Host header injections.

The reason is to avoid Host header injections.
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply

#3
Thank you kenjis.
Reply

#4
You're welcome.

I found that User Guide has clear explanation how to do.
http://www.codeigniter.com/user_guide/in...-not-empty
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.