Skip to content

Commit

Permalink
Set this only if the HTTP host is not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparsd committed Nov 9, 2023
1 parent 8c42839 commit 7529e05
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions vip-config/vip-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,15 @@

/**
* Set site domain for NewRelic in order to have separate logs for each site.
*
* phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
*/
if ( isset( $_SERVER['HTTP_HOST'] ) && function_exists( 'newrelic_set_appname' ) ) {
if ( ! empty( $_SERVER['HTTP_HOST'] ) && function_exists( 'newrelic_set_appname' ) ) {
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- it is ok, the code is copied from docs: https://docs.wpvip.com/technical-references/new-relic-for-wordpress/#h-separate-apps-out-on-a-per-site-basis-for-multisite
$app_name = $_SERVER['HTTP_HOST'];
if ( defined( 'VIP_GO_APP_ENVIRONMENT' ) && ! empty( $app_name ) ) {

// Append the environment name, if present.
if ( defined( 'VIP_GO_APP_ENVIRONMENT' ) ) {
$app_name .= '-' . VIP_GO_APP_ENVIRONMENT;
}

Expand Down

0 comments on commit 7529e05

Please sign in to comment.