What is the correct way to set a hostname in Horizon?

Hosting server is configured to horizon.stellar.domain.com but within Horizon the generated paths for all href attributes show http://horizon/... instead of https://horizon.stellar.domain.com.

On the server the HOSTNAME environment variable as well as hostname command return horizon.stellar.domain.com correctly. /etc/sysconfig/network contains HOSTNAME=horizon.stellar.domain.com.

How do I get Horizon to display the correct hostname in HTTP responses?

  • 2
    Not aware of a configuration parameter for it but it seems to just take the Host from the http request. Try curl localhost:YourHorizonPort --header "Host: whatever" for example. Do you have a proxy in front of your horizon that rewrites the host header?
    – sui
    Feb 18 '19 at 14:11
  • Yes, I do and the upstream is called "horizon". Thanks! Makes sense. Will look into that. PS: I should have just kept digging in the source code but was too busy... thanks for the help.
    – marcinx
    Feb 18 '19 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.