We tried setting varnish config

Keywords: Magento - AWS - Technical issue - Application configuration

bnsupport ID: 53ee74a8-af18-95cb-4d09-0ff7e6780da0

bndiagnostic output:

? Apache: Found possible issues
https://docs.bitnami.com/general/apps/wordpress/troubleshooting/debug-errors-apache/
https://docs.bitnami.com/bch/apps/moodle/troubleshooting/deny-connections-bots-apache/

bndiagnostic failure reason: The tool could not find any issue

Description:
we are seeing issues on our website where, our menu show a 503 error instead of the menu bar. we think this is down to the varnish options need changing to something like the following

export VARNISH_OPTIONS ="-p feature=+esi_ignore_other_elements
-p feature=+esi_disable_xml_check
-p feature=+esi_ignore_https
-p http_resp_hdr_len=16k
-p http_resp_size=64k
-p workspace_backend=64k"

where do we put this option as we have put it in the varnish-env.sh and it didn’t work.

Hi @tom.peacock,

Thanks for using Bitnami. Before to start modifying the instance, please create a server backup to be sure you can easily recover your current status

https://docs.bitnami.com/aws/faq/administration/backup-restore-server/

I launched a fresh new Magento instance and I was able to add the custom parameters using the steps below.

  • First create a backup of the /opt/bitnami/scripts/libvarnish.sh file
sudo cp /opt/bitnami/scripts/libvarnish.sh /opt/bitnami/scripts/libvarnish.sh.bck
  • Next edit the file and append your desired options to the args array in the varnish_opts method. For reference, the updated method on my side looks like the one below
varnish_opts() {
    local -a args

    # Enable Varnish jail mechanism when running as root ("-j" must be the first argument)
    am_i_root && args+=("-j" "unix,user=${VARNISH_DAEMON_USER},ccgroup=${VARNISH_DAEMON_GROUP}")

    # Construct argument list to pass to Varnish
    args+=(
        "-a" "${VARNISH_LISTEN_ADDRESS}:${VARNISH_PORT_NUMBER}"
        "-f" "$VARNISH_CONF_FILE"
        "-P" "$VARNISH_PID_FILE"
        "-p" "feature=+esi_ignore_other_elements"
        "-p" "feature=+esi_disable_xml_check"
        "-p" "feature=+esi_ignore_https"
        "-p" "http_resp_hdr_len=16k"
        "-p" "http_resp_size=64k"
        "-p" "workspace_backend=64k"
    )

    # Check if the secret file was enabled
    [[ -f "$VARNISH_SECRET_FILE" ]] && args+=("-S" "$VARNISH_SECRET_FILE")

    # Memory allocation configuration
    [[ -n "$VARNISH_STORAGE" ]] && args+=("-s" "$VARNISH_STORAGE")

    # Allow passing extra arguments to Varnish
    args+=("$@")

    echo "${args[@]}"
}
  • Finally, restart Varnish and check the new options are listed
sudo /opt/bitnami/ctlscript.sh restart varnish

AH, thank you that makes so much sense!

We ended up doing it this way

editing the /opt/bitnami/varnish/scripts/start.sh file

“${VARNISH_SBIN_DIR}/varnishd” “${varnish_args[@]}” “-phttp_resp_hdr_len=16k” #"-phttp_resp_size=64k" “-pworkspace_backend=64k”

we will use your way though as it is a lot more robust

Hi @tom.peacock,

Thanks for the info. I’m glad you fixed your issue! Let us know if we can close this thread as solved. Please do not hesitate to open a new one with any other questions you may have.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.