Information for: DEVELOPERS   PARTNERS

Best practices for developing with Acquia Content Hub

Acquia Content Hub is a multi-layered product, and many of its functions work through the use of webhooks. After you register a webhook you can send and receive content.

Local development

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

Problems posting and receiving entities

Local websites are often unable to post to or receive entities from the Acquia Content Hub.

  • Submitting: Acquia Content Hub will try to access a resource URL from your local website which is accessible from the public internet.
  • Receiving: If you are running your website locally, you won’t be able to receive content from Acquia Content Hub, as the local website can’t register or receive webhooks.

Solution

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

Recommendations for Mac users

  • Acquia recommends 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 you’re using. See Rewriting the Host header for more 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 sent to Acquia 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 earlier step.

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