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

How can I custom the Server header #579

Open
mirror222 opened this issue Mar 3, 2023 · 2 comments
Open

How can I custom the Server header #579

mirror222 opened this issue Mar 3, 2023 · 2 comments

Comments

@mirror222
Copy link

mirror222 commented Mar 3, 2023

Find the codes below, how can I change the response SERVER header to MYOWN.

Thank you.

image

`

        var server = new WebServer(o => o
                .WithCertificate(null)
                .WithUrlPrefix(url)
                .WithMode(HttpListenerMode.EmbedIO))
            .WithIPBanning(o => o
                .WithMaxRequestsPerSecond(30)                  
                .WithRegexRules("Too many requests 429"))
            .WithLocalSessionManager()
            .WithCors(
                // Origins, separated by comma without last slash
                "http://unosquare.github.io,http://run.plnkr.co",
                // Allowed headers
                "content-type, accept",
                // Allowed methods
                "post")
            .WithWebApi("/api", m => m
                .WithController<PeopleController>())
            .WithModule(new WebSocketChatModule("/chat"))
            .WithModule(new WebSocketTerminalModule("/terminal"))
            .WithStaticFolder("/", HtmlRootPath, true, m => m    //<----------
                .WithContentCaching(UseFileCache)                    
                );

`

@etherealbacon
Copy link

Hello and thanks everyone for the efforts with this project.

I am also trying to change the server header. I can see that it is set using the Signature read-only static string here:

public static readonly string Signature = "EmbedIO/" + Assembly.GetExecutingAssembly().GetCustomAttributes<AssemblyInformationalVersionAttribute>().First().InformationalVersion;

This looks like the project has deliberately made it difficult to change this?

Is there any way to change it for all responses?

@zhangzhezh
Copy link

HttpContext.Response.Headers.Add("Server", "Tengine");

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

3 participants