You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a PHP script which echoes the contents of $_SERVER['HTTP_X_REQUESTED_WITH']
Request it directly in AJAX (e.g. using jQuery, doing $(".output").load("test.php") or similar)
Request it via the proxy in AJAX, e.g. $(".output").load("proxy.php?mode=native&url=test.php")
Expected result:
The proxied script returns the same response for both requests
Actual result:
The response differs
Suggested fix:
Insert the following above the CURLOPT_FOLLOWLOCATION line:
// forward X-Requested-With header to ensure that if the server has an AJAX-specific response,
// it is preserved when using this proxy.
$headers_to_send = array();
if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) $headers_to_send[] = 'X-Requested-With: ' . $_SERVER['HTTP_X_REQUESTED_WITH'];
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers_to_send );
The text was updated successfully, but these errors were encountered:
Steps to reproduce:
Expected result:
Actual result:
Suggested fix:
Insert the following above the CURLOPT_FOLLOWLOCATION line:
// forward X-Requested-With header to ensure that if the server has an AJAX-specific response,
// it is preserved when using this proxy.
$headers_to_send = array();
if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) $headers_to_send[] = 'X-Requested-With: ' . $_SERVER['HTTP_X_REQUESTED_WITH'];
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers_to_send );
The text was updated successfully, but these errors were encountered: