CloudFoundry / Nginx / Grails and the X-Forwarded Header (Missing)

天大地大妈咪最大 提交于 2019-12-12 04:24:29

问题


Using CloudFoundry with Nginx, we're trying to get the X-Forwarded for header out in grails, but we can't seem to do so. It's either blank or the IP address of the Nginx server.

We often create sites where users are allowed to vote, and we want to be sure that they only vote once. Therefore, we'd like to use a combination of their network gateway (router) ip address and their X-Forwarded-For (internal) ip address so that we can check if people have already voted without having to block their entire network from voting because of one vote.

Unfortunately cookies have proven unreliable as users tend to use incogneto windows to make their votes. Using local storage has also proved unsuccessful as clients tend to delete their "website data" in order to vote again. The only other option is forcing them to create an account and verify their email address which is too much of a barrier to entry.

Is there a way that we can get a list of X-Forwarded for IP's in the chain (without Nginx stealing them), or is there a way we can create a service on Nginx that we can query to get the X-Forwarded-For header for the request, or can we create a "plugin" for Nginx to create a new header (X-Nginx-Forwarded-For)?


回答1:


I've never worked with Nginx, but it looks like you can add custom headers to the proxied request to the end server very easily. http://wiki.nginx.org/HttpProxyModule



来源:https://stackoverflow.com/questions/18189626/cloudfoundry-nginx-grails-and-the-x-forwarded-header-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!