Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get calling origin in NGINX

Can someone help us to add calling origin in NGINX header?

We need to whitelist calling origin on the basis of the origin (from where the request originated/triggered)

    location /some_filter_url {
            proxy_pass http://test-domain.com;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Origin {????? What should be used $http-origin is null};
    }

variable $http-origin giving us the value null while $host giving the current/original host.

Any Help will be appreciated. TIA.

like image 440
Mantu Nigam Avatar asked Sep 13 '25 10:09

Mantu Nigam


1 Answers

It is $http_origin with an underscore and not the dash.

like image 62
Danila Vershinin Avatar answered Sep 16 '25 03:09

Danila Vershinin