Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:00:46+00:00 2026-06-09T16:00:46+00:00

I am using two system (both are Nginx load balancer and one act as

  • 0

I am using two system (both are Nginx load balancer and one act as backup).

I want to add and use few HTTP custom headers.

Below is my code for both:

upstream upstream0 {
    #list of upstream servers
    server backend:80;
    server backup_load_balancer:777 backup;
    #healthcheck
}

server {
    listen 80;
    #Add custom header about the port and protocol  (http or https)
    server_name _;

    location / {
        # is included since links are not allowed in the post
        proxy_pass "http://upstream0;"
    }
}

Backup system

server {
    listen 777;
    server_name _;
    #doing some other extra stuff
    #use port and protocol to direct
}

How can I achieve that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:00:47+00:00Added an answer on June 9, 2026 at 4:00 pm

    To add a header, add the add_header declaration to either the location block or the server block:

    server {
       add_header X-server-header "my server header content!";
       location /specific-location {
           add_header X-location-header "my specific-location header content!";
       }
    }
    

    An add_header declaration within a location block will override the same add_header declaration in the outer server block.
    e.g. if location contained add_header X-server-header ... that would override the outer declaration for that path location.

    Obviously, replace the values with what you want to add. And that’s all there is to it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using System V Shared Memory to communicate between my two PHP applications. One
I've been using a system with imagettftext for a while now to add nog
I have homework that should use fork() and wait() system calls: 1) Write two
I have connected my two laptops using a cat5 cross ethernet cable. Both have
I have two server named server1 and server2.both having diffrent Static ip address.I want
I am using one server to build the same project both continuously and nightly;
I have two views which will both use the same Controller method: //webServiceController.cs //The
I have two simple programmes, server and client, both at localhost. What I want
For a project I'm using both Scala and Riak (two things I have never
Using EF 4.0. I have two entity models, both named CoreEntities, but in different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.