Position:Home > Play-Scala开发技巧 - 关闭X-Forwarded-For解析

Play-Scala开发技巧 - 关闭X-Forwarded-For解析

1. 为什么要关闭X-Forwarded-For解析?


2. 如何关闭X-Forwarded-For解析?


play.http.forwarded.trustedProxies = []

3.  如何启用X-Forwarded-For解析?


http {
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   Host $http_host;
    proxy_http_version 1.1;

1) 仅信任本地的反向代理服务器

play.http.forwarded.trustedProxies=["::1", ""]

2) 信任特定的代理服务器

play.http.forwarded.trustedProxies=["", "::1", ""]表示整个C类地址段,即192.168.0.0-。

Recommend:Logging syntax for Play Framework 2 in Scala

in Play Framework 2 (and in Scala). I've googled but its very difficult to find an example, essentially most links are talking about configuring Logback in the first place which I've done fine. I'm basically trying to f

3) 信任所有的代理服务器

play.http.forwarded.trustedProxies=["", "::/0"]

4. 参考

Setting up a front end HTTP server





Recommend:scala - Play too many arguments for method Apply

onfigured it this way: controller Application.scala package controllersimport play.api._import play.api.mvc._class Application extends Controller { def index = Action { Ok(views.html.index("Hello, again, worl

Recommend:angularjs - Using Angular with Play: Role for Scala Templates

entasks sample and the fluid, clean, effortless Javascript routing that left the work of rendering things to Play. But we decided instead to go with Angular. Upon going down that road, I thought that Angular would contro

Your Answer
(Ctrl+Enter To Post)   
    Copyright © 2015-2017 163JAVA.COM All Rights Reserved.