Reply
Highlighted
Accepted Solution

Nginx reverse proxy for the RESTful API

ddiguru
Member
Posts: 0
5997     0

Has anyone successfully put an NGINX instance in front of the RESTful API on a grid using its reverse proxy features? 

 

I have tried but can't seem to get authentication working properly by proxying the cookie and rewriting the domain using proxy_cookie_domain directive. So, at the moment, its passing the Auth header and is authenticating the user w/ each request. 

 

Any help is appreciated!

 

Cheers!

Re: Nginx reverse proxy for the RESTful API

ddiguru
Member
Posts: 0
5998     0

Silly me! Figured it out. I had set up my nginx instance to run on http port 8080 and didn't configured it with SSL. I had done that to avoid colliding with another web server instance on the development system i was running. Well, the Infoblox RESTful response header sets the ibabuath cookie with the secure flag. Therefore, set-cookie wasn't working since i had an HTTP instance in front of an HTTPS RESTful API instance. 

 

As soon as I configured my nginx instance to use SSL, it all started working!

 

My nginx configuration is as follows:

server {
    listen       443;
    ssl           on;
    ssl_certificate /usr/local/etc/pki/server.crt;
    ssl_certificate_key /usr/local/etc/pki/server.key;
    server_name  myhost.local;

    location /wapi {
        proxy_cookie_domain ~ my-infoblox-gm.local;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass https://my-infoblox-gm.local/wapi/v2.6;
    }

    location / {
        root   /var/www/myhost.local;
        index  index.html index.htm;
    }
}

When I use curl or wget, I reach the Infoblox RESTful API endpoint by using https://myhost.local/wapi instead of https://my-infoblox-gm.local/wapi/v2.6.

 

Hope this helps someone... 

Showing results for 
Search instead for 
Do you mean 

Recommended for You

Demo: Infoblox IPAM plug-in integration with OpenStack Newton