- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Nginx reverse proxy for the RESTful API
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-20-2017 08:11 AM
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!
Solved! Go to Solution.
Re: Nginx reverse proxy for the RESTful API
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-20-2017 10:10 AM
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...