ocsigen / ocsigenserver

Web server in OCaml.
http://ocsigen.org/ocsigenserver/
Other
101 stars 31 forks source link

defaulthostname warning occurs when it shouldn't #118

Open agarwal opened 7 years ago

agarwal commented 7 years ago

I'm passing a config file like this to ocsigenserver

<ocsigen>
  <server>
    ...
    <host defaulthostname="localhost">
      <eliom mysite.cma">
      </eliom>
    </host>
  </server>
</ocsigen>

and I get the warning:

ocsigenserver: ocsigen:config: Cannot determine default host name. Will use "mylaptop.local" to create absolute links or redirections dynamically if you do not set <host defaulthostname="..." ...> in config file.

Why? The config file does set defaulthostname exactly as suggested in the warning. This didn't used to happen. I upgraded ocsigenserver recently, so maybe a bug was introduced.

agarwal commented 7 years ago

I've confirmed that the defaulthostname config setting is not getting picked. So the warning is actually correct. The error is that the setting isn't detected. I've also set defaultprotocol and that works fine.

balat commented 7 years ago

I was unable to reproduce this. I tried with version 48e67b4112afe0e3c2eccaea520c3a59c7c34bfa and with the very last 079bf8647e1b6ad924515ffae6014e6243fbf92c ...

Do you have several hosts in the config file?

agarwal commented 7 years ago

Weird. I'm on 079bf864 and have the same problem in 2 different projects. Config files are fairly simple. Here's a complete one.

$ cat config.xml 
<ocsigen>
  <server>
    <debugmode/>
    <port protocol="HTTP">8082</port>
    <logdir>_var/log</logdir>
    <datadir>_var/data</datadir>
    <charset>utf-8</charset>
    <extension findlib-package="core"/>
    <extension findlib-package="ocsigenserver.ext.staticmod"/>
    <extension findlib-package="ocsigenserver.ext.ocsipersist-sqlite"/>
    <extension findlib-package="eliom.server"/>

    <host defaulthostname="localhost">
      <static dir="_build/_site/" />
      <eliom xhr-links="no" module="_build/_server/eliom-starter.cma">
      </eliom>
    </host>

  </server>
</ocsigen>
agarwal commented 7 years ago

It only happens on my Mac, not Ubuntu.

balat commented 7 years ago

I just tried on MacOS but it works for me ...

Are you sure you don't have something weird with your configuration files? Do you have other differences in the config files?

agarwal commented 7 years ago

I haven't been able to pin down a reproducible example of this, but it still happens at various times. I'll report more when I have something useful.