How to get calling origin in NGINX

Viewed 778

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.

1 Answers

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

Related