Middleware/DnsRebindingProtectionMiddleware.php

php-sdk · src/Server/Transport/Http/Middleware/DnsRebindingProtectionMiddleware.php · php · Apache-2.0
integration, Integration / API

Middleware that protects HTTP servers from DNS rebinding attacks by validating Host and Origin headers.

// Source: https://github.com/modelcontextprotocol/php-sdk | License: Apache-2.0
// Provided via justclaw.it.com; keep this notice with the code.
<?php

/*
 * This file is part of the official PHP MCP SDK.
 *
 * A collaboration between Symfony and the PHP Foundation.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Mcp\Server\Transport\Http\Middleware;

use Http\Discovery\Psr17FactoryDiscovery;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

/**
 * Protects local MCP servers against 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key