FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

hostnameHeader

v1.0.9 Public

Hostname Header

Add server hostname headers to your app in one module

This module determines the servers internal host name, and then creates a response header for you.

This module is ideal for clustered setups, or docker swarms, where the code could be running on one of many servers. In Docker, can you search for this hostname in portainer or via the CLI, making debugging much easier

How does it work?

Response Header

The module sets a header called x-server-hostname.

When does it run?

The module listens to the onRequestCapture ColdBox interception point.

With Errors, this function might not run... if that interception point is not announced. You might need to add to your Application.cfc directly if errors occur before the ColdBox framework loads.

How does it determine the hostname?

This module looks for the hostname a few different ways.

  • First, it looks for the hostname in /etc/hostname file.
  • If that does not work, it uses java to get the hostname.
var inet = CreateObject("java", "java.net.InetAddress");
var hostname = inet.getLocalHost().getHostName();
  • Note - Java errors when trying to return a hostname that does not resolve to an IP, so in docker, this hashed hostname will not resolve, unless you add it dynamically to the /etc/hosts file.

Here are all the versions for this package. Please note that you can leverage CommandBox package versioning to install any package you like. Please refer to our managing package version guide for more information.

Version Created Last Update Published By Stable Actions
Current
1.0.9 Mar 28 2018 11:11 AM Mar 28 2018 11:11 AM
Version History
1.0.8 Mar 28 2018 11:05 AM Mar 28 2018 11:05 AM
1.0.7 Mar 22 2018 12:37 PM Mar 22 2018 12:37 PM
1.0.6 Mar 22 2018 12:24 PM Mar 22 2018 12:24 PM
1.0.4 Mar 22 2018 12:06 PM Mar 22 2018 12:06 PM
1.0.3 Mar 22 2018 11:44 AM Mar 22 2018 11:44 AM
1.0.2 Mar 22 2018 01:15 AM Mar 22 2018 01:15 AM

 

No collaborators yet.
     
  • Mar 22 2018 01:15 AM
  • Mar 28 2018 11:11 AM
  • 327
  • 0
  • 3504