Jump to content

httpUrl - which host is used?


chrizz
 Share

Recommended Posts

I was wondering which logic is behind the httpUrl method when multiple hosts are availble?

My config says 

$config->httpHosts = array('api.local', 'www.api.local', '10.0.1.10');

$page->httpUrl returns always api.local. In the current setup 10.0.1.10 would be appreciated.

Is there any logic behind this or is just the first host taken for the httpUrl() call?

Checking the code brings up this comment
 

Quote

* This is set automatically by ProcessWire at runtime, consisting of one of the values 
* specified in $config->httpHosts. However, if you set a value for this, it will override
* ProcessWire's runtime value. 

But: How is this runtime valued defined when I use this method in a hook?

 

Link to comment
Share on other sites

thanks for bringing this up. To me this means: a cronjob will always use the first defined host, as there's no $_SERVER variable available, aye? Unless for sure the cronjob is called via http (e.g. "curl https:host.../")

 

Thanks for your feedback - helps a lot ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...