What is the difference between HTTP_USER_AGENT and HTTP_X_USER_AGENT?

http, http-headers, php

Solution

The HTTP headers beginning with `X` are officious headers. They are not specified in the HTTP specification, but just coined by some 3rd party as kind of vendor-specific or "de facto" standard and taken over by many others, like HTTP `X-Forwarded-For` in case of proxy servers.

The particular HTTP `X-User-Agent` header is often inserted by some independent messenger between the actual client and the server, like a proxy, loadbalancer, transcoder, etc, but also some XMLHttpRequest based libraries. It often identifies the messenger itself. The `User-Agent` header should still represent the actual client. You also see this header sometimes in emails, this then represents the email program/software responsible for sending the mail.

That it is called `HTTP_X_USER_AGENT` (uppercased, `HTTP` prefix, underscores instead of hyphens) is PHP specific.

Problem

I sometimes see one or the other in my server logs.

Original source