wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.
send_origin_headers › WordPress Function
Od3.4.0
Przestarzałyn/a
› send_origin_headers ( Brak parametrów )
| Powrót: |
|
| Zdefiniowane na: |
|
| Codex: |
Sends Access-Control-Allow-Origin and related headers if the current request is from an allowed origin.
If the request is an OPTIONS request, the script exits with either access control headers sent, or a 403 response if the origin is not allowed. For other request methods, you will receive a return value.Powiązane Funkcje: rest_send_cors_headers, login_header, do_signup_header, send_frame_options_header, send_nosniff_header
Źródło
function send_origin_headers() {
$origin = get_http_origin();
if ( is_allowed_http_origin( $origin ) ) {
header( 'Access-Control-Allow-Origin: ' . $origin );
header( 'Access-Control-Allow-Credentials: true' );
if ( 'OPTIONS' === $_SERVER['REQUEST_METHOD'] ) {
exit;
}
return $origin;
}
if ( 'OPTIONS' === $_SERVER['REQUEST_METHOD'] ) {
status_header( 403 );
exit;
}
return false;
}