Score:0

Nginx proxy_pass is not passing customized header into the server

in flag

I have Nginx installed on my machine and serve 2 domains.

  1. https://example.com/ -> Frontend.
  2. https://api.example.com/ -> Backend.

I'm communicating backend application through the frontend, But it's seem to be that the backend application does not receive any header from the Nginx.

This is my Nginx.conf:

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log;

events {} # event context needs to be defined to consider config valid
http{
    include /etc/nginx/mime.types;
    server {
        listen 80;
        root /usr/share/nginx/html;
        server_name studenttracker.co.il;

        location / {
            try_files $uri $uri/ /index.html;
        }

    }
    server {
        listen 80;
        server_name api.studenttracker.co.il;

        location / {
            proxy_pass_request_headers      on;
            proxy_pass http://159.223.2.114:8443;       
            proxy_set_header Host api.studenttracker.co.il;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Cookie $http_cookie;
         }
    }
}

The backend application except to receive 2 headers in order to get authorized PARAM_ID_AUTH and PARAM_X_AUTH.

While sending it, It's seem to be that the header does not arrive to the backend application at all.

enter image description here

I will Appreciate you help, Thanks!

br flag
https://stackoverflow.com/a/22856867/1016033
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.