启用http-forwarded模块,执行如下命令:

java -jar $JETTY_HOME/start.jar --add-modules=http-forwarded

命令的输出,如下:

INFO  : http-forwarded  initialized in ${jetty.base}/start.d/http-forwarded.ini
INFO : Base directory was modified

http-forwarded模块的配置文件$JETTY_BASE/start.d/http-forwarded.ini,内容如下:

# ---------------------------------------
# Module: http-forwarded
# Enables processing of the "Forwarded" HTTP header (and its predecessors "X-Forwarded-*" HTTP headers).
# The "Forwarded" HTTP header is added by intermediaries to provide information about the clients.
# ---------------------------------------
--modules=http-forwarded ### ForwardedRequestCustomizer Configuration ## Whether to process only the RFC7239 "Forwarded" header.
## "X-Forwarded-*" headers are not processed.
# jetty.httpConfig.forwardedOnly=false ## Whether the address obtained from "Forwarded: by=" or
## "X-Forwarded-Server" is used in the request authority.
# jetty.httpConfig.forwardedProxyAsAuthority=false ## Whether the "X-Forwarded-Port" header is used in the request authority,
## or else it is the remote client port.
# jetty.httpConfig.forwardedPortAsAuthority=true ## The name of the RFC 7239 HTTP header.
# jetty.httpConfig.forwardedHeader=Forwarded ## The name of the obsolete forwarded host HTTP header.
# jetty.httpConfig.forwardedHostHeader=X-Forwarded-Host ## The name of the obsolete forwarded server HTTP header.
# jetty.httpConfig.forwardedServerHeader=X-Forwarded-Server ## The name of the obsolete forwarded scheme HTTP header.
# jetty.httpConfig.forwardedProtoHeader=X-Forwarded-Proto ## The name of the obsolete forwarded for HTTP header.
# jetty.httpConfig.forwardedForHeader=X-Forwarded-For ## The name of the obsolete forwarded port HTTP header.
# jetty.httpConfig.forwardedPortHeader=X-Forwarded-Port ## The name of the obsolete forwarded https HTTP header.
# jetty.httpConfig.forwardedHttpsHeader=X-Proxied-Https ## The name of the obsolete forwarded SSL session ID HTTP header.
# jetty.httpConfig.forwardedSslSessionIdHeader=Proxy-ssl-id ## The name of the obsolete forwarded SSL cipher HTTP header.
# jetty.httpConfig.forwardedCipherSuiteHeader=Proxy-auth-cert

各参数的说明,如下:

  • jetty.httpConfig.forwardedOnly

    是否仅处理标准的转发头部,跳过对非标扩展比如HTTP头部X-Forwarded-*的处理。

    默认值为false,即兼容非标HTTP头部X-Forwarded-*

    转发场景下的标准HTTP头部,可参考RFC文档Forwarded HTTP Extension
  • jetty.httpConfig.forwardedProxyAsAuthority

    从请求头部X-Forwarded-Server或者Forwarded: by=中得到的主机信息,是否参与认证。默认值为false
  • jetty.httpConfig.forwardedPortAsAuthority

    从请求头部X-Forwarded-Port获取到的端口信息,是否参与认证。默认值为true
  • jetty.httpConfig.forwardedHeader

    RFC文档Forwarded HTTP Extension中定义的转发头部,取值为Forwarded
  • jetty.httpConfig.forwardedHostHeader

    转发场景下的非标HTTP头部,取值为X-Forwarded-Host
  • jetty.httpConfig.forwardedServerHeader

    转发场景下的非标HTTP头部,取值为X-Forwarded-Server
  • jetty.httpConfig.forwardedProtoHeader

    转发场景下的非标HTTP头部,取值为X-Forwarded-Proto
  • jetty.httpConfig.forwardedForHeader

    转发场景下的非标HTTP头部,取值为X-Forwarded-For
  • jetty.httpConfig.forwardedPortHeader

    转发场景下的非标HTTP头部,取值为X-Forwarded-Port
  • jetty.httpConfig.forwardedHttpsHeader

    转发场景下的非标HTTP头部,默认值为X-Proxied-Https
  • jetty.httpConfig.forwardedSslSessionIdHeader

    默认值为Proxy-ssl-id

    参考代理和路由选择 URL中关于Client SSL Session ID Forwarding的说明,如下:

    默认 HTTP 标头称为 Proxy-ssl-id,但可以使用您选择的任何标头发送客户机的 SSL/TLS 会话 ID。

  • jetty.httpConfig.forwardedCipherSuiteHeader

    默认值为Proxy-auth-cert

    参考代理和路由选择 URL中关于Client SSL/TLS Certificate Forwarding的说明,如下:

    默认 HTTP 标头称为 Proxy-auth-cert,但可以使用您选择的任何标头发送客户机的 SSL/TLS 证书。

参考资料

Jetty的http-forwarded模块的更多相关文章

  1. Jetty使用教程(四:21-22)—Jetty开发指南

    二十一.嵌入式开发 21.1 Jetty嵌入式开发HelloWorld 本章节将提供一些教程,通过Jetty API快速开发嵌入式代码 21.1.1 下载Jetty的jar包 Jetty目前已经把所有 ...

  2. Jetty 开发指南:Jetty 内嵌开发

    Jetty的口号是“不要在Jetty中部署你的应用程序,在你的应用程序中部署Jetty!” 这意味着,作为将应用程序捆绑为要部署在Jetty中的标准WAR的替代方案,Jetty旨在成为一个软件组件,可 ...

  3. jetty学习小结

    1.什么是jetty? 开源HTTP服务器和Servlet引擎,是web应用的容器,同tomcat类似.由于其轻量灵活的特性,很多知名产品也应用了它,如maven.eclipse.hadoop.spa ...

  4. SpringBoot之旅第四篇-web开发

    一.引言 有了自动配置,springboot使web开发变得简单,这个在springboot之旅中的第一篇中就有体现,实际的开发中当然不会这么简单,很多时候我们都需要自己去定制一些东西.web开发的东 ...

  5. springboot知识点【笔记】

    # **一.**Spring Boot 入门 ## 1.Spring Boot 简介 > 简化Spring应用开发的一个框架:>> 整个Spring技术栈的一个大整合:>> ...

  6. 第二十三章 多项目集中权限管理及分布式会话——《跟我学Shiro》

    二十三章 多项目集中权限管理及分布式会话——<跟我学Shiro> 博客分类: 跟我学Shiro 跟我学Shiro  目录贴:跟我学Shiro目录贴 在做一些企业内部项目时或一些互联网后台时 ...

  7. Shiro学习(23)多项目集中权限管理

    在做一些企业内部项目时或一些互联网后台时:可能会涉及到集中权限管理,统一进行多项目的权限管理:另外也需要统一的会话管理,即实现单点身份认证和授权控制. 学习本章之前,请务必先学习<第十章 会话管 ...

  8. [从源码学设计]蚂蚁金服SOFARegistry之网络封装和操作

    [从源码学设计]蚂蚁金服SOFARegistry之网络封装和操作 目录 [从源码学设计]蚂蚁金服SOFARegistry之网络封装和操作 0x00 摘要 0x01 业务领域 1.1 SOFARegis ...

  9. 【SpringBoot1.x】SpringBoot1.x Web 开发

    SpringBoot1.x Web 开发 文章源码 简介 SpringBoot 非常适合 Web 应用程序开发.可以使用嵌入式 Tomcat,Jetty 或 Undertow 轻松创建独立的 HTTP ...

  10. 在maven多模块结构中,并且使用overlay的情况下使用jetty热部署

    在使用maven多模块的结构的时候,同时有多个web工程使用maven-war-plugin的overlay来组织的时候,本地开发时如何在eclipse里面启动容器并且可以热部署调试是个比较麻烦的问题 ...

随机推荐

  1. 亲测CentOS 8.2更换yum源报错Errors during downloading metadata for repository 'epel': - Status code解决办法

    重点 提一件拉胯的事:别去参考阿里和华为云官方镜像上面的解决办法,本人试了几遍,没luan用.拉胯!!!!!!!! 报错具体信息 Errors during downloading metadata ...

  2. Kotlin 协程五 —— 在Android 中使用 Kotlin 协程

    目录 一.Android MVVM 结构 二.添加依赖 三.在后台线程中执行 3.1 协程解决了什么问题 3.2 保证主线程安全 3.3 withContext 的性能 四.结构化并发 4.1 追踪协 ...

  3. java图书管理系统

    一 .需求 1.使用数组存储学生(学号.姓名.性别.年级.院系.班级)信息数据和图书(书号.书名.出版日期.作者.价格.类别)信息数据 2.学生管理功能:增加学生.删除学生信息.修改学生信息.查询学生 ...

  4. Java 多线程------多线程的创建,方式一:继承于Thread类

    1 package com.bytezero.thread; 2 3 /** 4 * 多线程的创建,方式一:继承于Thread类 5 * 1.创建一个继承于Thread类的子类 6 * 2.重写Thr ...

  5. VC+MFC button获取+list复制+获取+页面转换+登录与数据库账户,密码进行对比 +基础知识

    1 // DlgExec.cpp : 实现文件 2 // 3 4 #include "stdafx.h" 5 #include "Self.h" 6 #incl ...

  6. C++ //STL---常用算法 //常用遍历 for_each //transform

    1 //STL---常用算法 2 //常用遍历 for_each 3 //transform 4 #include<iostream> 5 #include<string> 6 ...

  7. SelectZenEmpty 下拉框 支持 最大长度 超出... vue 组件

    <template> <Select v-model="innerValue" :disabled="disabled" :clearable ...

  8. Google Chart API学习(一)

    圆饼示例: <html> <head> <!--Load the AJAX API--> <script type="text/javascript ...

  9. vue+springboot图片上传和显示

    一.前言 在使用spring boot做后台系统,vue做前端系统,给客户开发一套系统时候,其中用到了图片上传和显示的功能. 二.环境 前端:vue 前端组件:tinymce 后台:spring bo ...

  10. PAT甲级【1014 Waiting in Line】

    考察双向链表 import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; ...