Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X-Powered-By keep showing when I leave it empty in config file #58

Closed
hyquoccuong opened this issue Jan 11, 2021 · 4 comments
Closed

X-Powered-By keep showing when I leave it empty in config file #58

hyquoccuong opened this issue Jan 11, 2021 · 4 comments

Comments

@hyquoccuong
Copy link

hyquoccuong commented Jan 11, 2021

In Laravel config/secure-headers.php

    /*
     * X-Powered-By
     *
     * Note: it will not add to response header if the value is empty string.
     */
    'x-powered-by' => '',

But in header it shows

X-Powered-By: PHP/7.2.28

If I change the value:

'x-powered-by'  => config('app.name'),

Header shows:

X-Powered-By: PHP/7.2.28
X-Powered-By: Laraspace

And if I change the config to

'x-powered-by' => [
    'enable' => false,
],

Now it shows:

X-Powered-By: PHP/7.2.28
X-Powered-By

I just want to hide/remove it completely or just show one line with set value in config file, could you please let me know how to do that?

@tobias-trozowski
Copy link

not sure about your setup and i'm not a lara user but u might check https://www.php.net/manual/en/ini.core.php#ini.expose-php

@aesyondu
Copy link
Contributor

aesyondu commented Mar 29, 2021

I have the same issue. Have you found a workaround @hyquoccuong ?

composer.json (versions):

{
  "bepsvpt/secure-headers": "v6.3.0",
  "laravel/lumen-framework": "v5.8.13",
}

config/secure-headers.php

    /*
     * X-Powered-By
     *
     * Note: it will not add to response header if the value is empty string.
     */

    'x-powered-by' => '',

@aesyondu
Copy link
Contributor

Nvm, thanks @tobias-trozowski. In my case it was the php.ini

  1. verify that expose_php is On
php -i | grep expose
# expose_php => On => On
  1. set expose_php to Off in php.ini
expose_php => Off => Off
  1. restart server and verify header is not shown

@bepsvpt
Copy link
Owner

bepsvpt commented Nov 19, 2022

Close due to inactive.

@bepsvpt bepsvpt closed this as completed Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants