Best practices for developing with Content Hub

Content Hub is a multi-layered product, and many of its functions work through the use of webhooks. After you register a webhook successfully you should be able to send and receive content.

Local development

Here are some tips for testing Content Hub on a local environment.

Problems posting and receiving entities

In general, local websites are unable to post to or receive entities from the Content Hub.

  • Submitting - Content Hub will try to access a resource URL from your local website that would need to be accessible from the public internet.
  • Receiving - If you are running your website locally, you will not be able to receive content from Content Hub, as the local website can not register or receive webhooks.

Solution

You can expose your local website to the outside world using a tool such as ngrok. You will need to download the latest version from their website.

Recommendations for Mac users

  • We recommend against using Homebrew to install, as users have had problems with the included version of ngrok.
  • Be sure to use a version of ngrok greater than 2.x.

After installation, complete the following steps:

  1. Create a free or paid account at ngrok.

  2. Download and install ngrok.

  3. Run ngrok from the command line, using the appropriate command for the version that you’re using. See Rewriting the Host header for additional information.

    • Free version

      ngrok http mylocaldomain.com:8083 -host-header=rewrite

      where mylocaldomain.com is the url of your local website and 8083 is the appropriate local port.

    • Paid version

      ngrok http -subdomain= -host-header=rewrite

  4. Set the rewrite_localdomain variable to rewrite the resource URL that is sent to Content Hub:

    drush config-set acquia_contenthub.admin_settings rewrite_domain 'http://mytunnel.ngrok.io'

    where mytunnel is your ngrok tunnel name created in the previous step.

After these are set, the tunnel should be ready for use.

Contact supportStill need assistance? Contact Acquia Support

Acquia: Think Ahead

53 State Street, 10th Floor
Boston, MA 02109
United States
Phone: 888-922-7842

Map: Google Maps
View other locations