[wp-trac] [WordPress Trac] #31737: Unique identifier for Heartbeat API calls

WordPress Trac noreply at wordpress.org
Mon Mar 23 09:37:52 UTC 2015


#31737: Unique identifier for Heartbeat API calls
-------------------------+-----------------------------
 Reporter:  ojrask       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Autosave     |    Version:  4.1.1
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 ''I chose ''Autosave'' as it is the most close component to the Heartbeat
 API.''

 ----

 Currently it seems that the Heartbeat API call made are not differentiated
 as Heartbeat API calls. The AJAX URL used is the global JS `ajaxurl`
 variable and the user agent is the same as the user's browser user-agent.

 This makes it difficult to parse them off general server access logs and
 so on.

 ----

 Could it be possible to add a query variable (e.g. `admin-
 ajax.php?heartbeat=1`) or change/append the user-agent to `WordPress
 Heartbeat API` or something?

 If a user logs in to `wp-admin` and leaves the session open, Apache's
 `access.log` files will be filled with unwanted clutter originating from
 the Heartbeat API requests.

 With a query variable or a customized user agent server admins could
 redirect the Heartbeat API traffic logs to a custom log file or even
 `/dev/null` if they wish to. This could be possible with the following
 server directive in Apache for instance:

 {{{
 # Determine user agent, set environment variable depending on it.
 SetEnvIfNoCase User-Agent ".*WordPress Heartbeat API.*" heartbeatrequest

 # Normal access log, without user-agent checked heartbeat calls.
 CustomLog /path/to/access.log combined env=!heartbeatrequest

 # Heartbeat calls go to another log file.
 CustomLog /path/to/heartbeat.log combined env=heartbeatrequest
 }}}

 I know some Heartbeat API settings can be tinkered with a plugin or a
 theme using hooks and globals, but I think this addition should be made
 into the core to keep it consistent across the board.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31737>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list