国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

部署的時(shí)候,是否可以修改或去除響應(yīng)標(biāo)頭Server的值為wrokerman

fanyin

部署的時(shí)候,是否可以修改或去除響應(yīng)標(biāo)頭Server的值

在部署到服務(wù)器的時(shí)候,通常不想讓別人知道后端程序采用什么語言開發(fā)的,因此請(qǐng)問大家,是否支持去除響應(yīng)標(biāo)頭的Server值,比如TP框架的部署到服務(wù)器上是顯示Apache或者Nginx. 那么webman開發(fā)的還是顯示workerman,是否有方法可以去除或修改。
如果所示:
響應(yīng)標(biāo)頭圖示

1326 2 4
2個(gè)回答

charlescc

加個(gè)中間件就行了。 看源碼是判斷有沒有設(shè)置header,沒有header server 就會(huì)拼上這個(gè)

class ApiFormat implements MiddlewareInterface
{

    public function process(Request $request, callable $handler): Response
    {
        /**
         * @var Response $response
         */
        $response = $handler($request);
        $response->header('Server','charles');
        return $response;
    }
}

然后就會(huì)

  • fanyin 2023-12-30

    感謝,這方法管用!這樣就不必破壞源代碼了

  • meows 2023-12-31

    真機(jī)智

efnic

修改根目錄下的/support/Response.php

<?php

namespace support;

/**
 * Class Response
 * @package support
 * @link http://www.wtbis.cn/doc/webman/response.html
 */
class Response extends \Webman\Http\Response
{
    public function __construct($status = 200, $headers = array(), $body = '')
    {
        $headers['Server'] = 'nginx';
        parent::__construct($status, $headers, $body);
    }
}
年代過于久遠(yuǎn),無法發(fā)表回答
??