Cookie rejected: Illegal path attribute "/nexus". Path of origin: "/content/" 解
问题叙述性说明
通过运行“mvn clean deploy” 命令 将 Maven 项目公布 Nexus 当PW。举例控制台输出以下警告消息:
[INFO] Downloaded: dav:http://maven.mysite.com/content/repositories/snapshots/${groupId}/${artifactId}/${version}/maven-metadata.xml (2 KB at 10.5 KB/sec)
[INFO] Uploading: http://maven.mysite.com/content/repositories/snapshots/${groupId}/${artifactId}/${version}/${artifactId}-xxx.jar
2015-3-19 10:20:47 org.apache.commons.httpclient.HttpMethodBase processResponseHeaders
警告: Cookie rejected: "$Version=0; rememberMe=deleteMe; $Path=/nexus". Illegal path attribute "/nexus". Path of origin: "/content/"
2015-3-19 10:20:47 org.apache.commons.httpclient.HttpMethodBase processResponseHeaders
警告: Cookie rejected: "$Version=0; rememberMe=deleteMe; $Path=/nexus". Illegal path attribute "/nexus". Path of origin: "/content/repositories/"
2015-3-19 10:20:47 org.apache.commons.httpclient.HttpMethodBase processResponseHeaders
警告: Cookie rejected: "$Version=0; rememberMe=deleteMe; $Path=/nexus". Illegal path attribute "/nexus". Path of origin: "/content/repositories/snapshots/"
2015-3-19 10:20:47 org.apache.commons.httpclient.HttpMethodBase processResponseHeaders
警告: Cookie rejected: "$Version=0; rememberMe=deleteMe; $Path=/nexus". Illegal path attribute "/nexus". Path of origin: "/content/repositories/snapshots/${groupId}/"
2015-3-19 10:20:47 org.apache.commons.httpclient.HttpMethodBase processResponseHeaders
警告: Cookie rejected: "$Version=0; rememberMe=deleteMe; $Path=/nexus". Illegal path attribute "/nexus". Path of origin: "/content/repositories/snapshots/${groupId}/${artifactId}/"
2015-3-19 10:20:47 org.apache.commons.httpclient.HttpMethodBase processResponseHeaders
警告: Cookie rejected: "$Version=0; rememberMe=deleteMe; $Path=/nexus". Illegal path attribute "/nexus". Path of origin: "/content/repositories/snapshots/${groupId}/${artifactId}/${version}/"
2015-3-19 10:20:47 org.apache.commons.httpclient.HttpMethodBase processResponseHeaders
警告: Cookie rejected: "$Version=0; rememberMe=deleteMe; $Path=/nexus". Illegal path attribute "/nexus". Path of origin: "/content/repositories/snapshots/${groupId}/${artifactId}/${version}/${artifactId}-xxx.jar"
…… ……
[INFO] Uploaded: http://maven.mysite.com/content/repositories/snapshots/${groupId}/${artifactId}/${version}/${artifactId}-3.0.4-20150319.022040-25.jar (60 KB at 76.6 KB/sec)
系统环境
私服是搭建在一台 Windows Server 2008 的阿里云server上,Nexus 的版本号为 2.8.1,通过 Ngnix 1.7.10 进行反向代理(http://maven.mysite.com/ 直接指向 http://127.0.0.1:8081/nexus)。
开发机是 Windows 7,使用 Maven 版本号为 3.0.4。
问题分析
依据控制台输出的警告信息可知,这是 cookie 的 path 属性不一致,须要 path=/nexus 下的 cookie,而如今相应的路径 /content/repositories/snapshots/${groupId}/${artifactId}/${version}/ 中并不包括 /nexus 这一级。
依据这个推断,于是我将 snapshots 的 URL 由 http://maven.gboat.xyz/content/repositories/snapshots
改为 http://maven.gboat.xyz:8081/nexus/content/repositories/snapshots,然后又一次运行 mvn clean deploy 公布 jar 包到私服,这一次的公布过程中果然没有出现不论什么警告信息。
由于改动之后的这个 URL 是没有通过 Nginx 作代理进行转发的,所以。如今已经能够确定问题是出在 Nginx 的代理配置这一块了。
解决方式
问题产生的原因已经找到了。接下来就是依据问题原因寻找相应的解决方式了。
经过查阅资料得知。仅仅须要在 Nginx 的代理配置中添加 cookie 的 path 映射关系就可以。官方文档请參见:ngx_http_proxy_module
模块中的 proxy_cookie_path,改动后的配置例如以下:
# Maven
server {
listen 80;
server_name maven.mysite.com; location / {
proxy_pass http://127.0.0.1:18081/nexus/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_cookie_path /nexus /;
…… ……
}
location ~ ^/nexus/(.*)$ {
return 301 /$1;
}
}
另外,假设您是使用的 Apathe 做反向代理。那应该通过 ProxyPassReverseCookiePath 进行配置,如:
ProxyPassReverseCookiePath /nexus /
參考资料:http://books.sonatype.com/nexus-book/reference/install-sect-proxy.html
版权声明:本文博主原创文章。博客,未经同意不得转载。
Cookie rejected: Illegal path attribute "/nexus". Path of origin: "/content/" 解的更多相关文章
- httpclient提示Cookie rejected: violates RFC 2109: domain must start with a dot
使用httpclient时发生如下告警信息: WARN - HttpMethodBase.processResponseHeaders(1505) | Cookie rejected: "$ ...
- HttpClient3.1 警告: Cookie rejected:
四月 , :: 下午 org.apache.commons.httpclient.HttpMethodBase processCookieHeaders 警告: Cookie rejected: : ...
- The Path Attribute
https://tools.ietf.org/html/rfc6265#section-5.1.1 4.1.2.4. The Path Attribute The scope of each cook ...
- python:PATH、PYTHONPATH 和 sys.path 的区别
python:PATH.PYTHONPATH 和 sys.path 的区别 共同点 所有在它们的路径里面的 moduel 都可以被 import PATH 在 PATH 中的一些命令,例如 *.exe ...
- 安装vmware-tools遇the path "" is not valid path to the gcc binary和the path "" is not a valid path to the 3.10.0-327.e17.x86_64 kernel headers问题解决
#./vmware-install.pl踩点: 1.the path "" is not valid path to the gcc binary 2.the path " ...
- The path is not a valid path to the xxx kernel header
在安装vmtools时无意中出现了这样的问题 1.gcc错误 Searching for GCC- The path "" is not valid path to the gcc ...
- vmware + centos 7安装vmtools时提示The path "" is not a valid path to the xxx kernel header
在安装vmtools时无意中出现了这样的问题 1.gcc错误 Searching for GCC- The path "" is not valid path to the gcc ...
- python3 os.path.realpath(__file__) 和 os.path.cwd() 方法的区别
python3 os.path.realpath(__file__) 和 os.path.cwd() 方法的区别 os.path.realpath 获取当前执行脚本的绝对路径. os.path.rea ...
- VMware安装VMware tool是 遇到The path "" is not a valid path to the 3.10.0-693.el7.x86_64 kernel headers.
The path "" is not a valid path to the 3.10.0-693.el7.x86_64 kernel headers.问题是找不到内核头文件,需要 ...
随机推荐
- Python多线程2:sched
sched模块提供了一个类的事件安排. scheduler类定义 class sched.scheduler(timefunc=time.monotonic, delayfunc=time.sleep ...
- hdu 1536(博弈)
传送门:S-Nim 题意:给n个数的集合s, 再给m 组数据,每组表示 k 堆石子,每次可以取的个数只能是集合s中的数量.问先手胜还是输? 分析:sg函数的经典运用,先预处理出所有数量为0~10000 ...
- hdu4612(双连通缩点+树的直径)
传送门:Warm up 题意:询问如何加一条边,使得剩下的桥的数目最少,输出数目. 分析:tarjan缩点后,重新建图得到一棵树,树上所有边都为桥,那么找出树的直径两个端点连上,必定减少的桥数量最多, ...
- spring MVC拦截器01
spring MVC拦截 作用:身份校验,权限检查,防止非法訪问. 场景:一个bbs系统,用户没有登录就无法发帖或者删除评论; 一个博客系统,没有登录就无法发表博文,无法添加分类,无法删除博文. sp ...
- hdu 2451 Simple Addition Expression(数位DP )成败在于细节
亚洲区域赛的题,简单的数位DP题,注重细节. 任何细节都有可能导致wa,所以没有绝对的水题. 把握好细节,此题便A. #include<stdio.h> __int64 getans(__ ...
- 自己动手写了第三阶段的处理器——教学OpenMIPS处理器蓝图
我们会继续上传新书<自己动手写处理器>(未公布).今天是第十条.我每星期试试4 从本章開始将一步一步地实现教学版OpenMIPS处理器.本章给出了教学版OpenMIPS的系统蓝图,首先介绍 ...
- SAE微信公众号PHP SDK, token一直验证失败
用的是SAE,创建的是微信公众号PHP SDK框架,里面example文件夹下有server.php用来验证token的.但是问题来了,无论我怎么输入URL和token,一直告诉我token验证失败. ...
- 新西兰gap year_百度百科
新西兰gap year_百度百科 新西兰gap year Working Holiday Visa,即打工度假签证.它允许旅行者出于补贴旅行费用的目的而在签证颁发国边打工边旅行.用来鼓励双方国家 ...
- extjs4 分页工具栏pagingtoolbar的每页显示数据combobox下拉框
var itemsPerPage = 20; var combo; //创建数据源store Ext.define('recordStore', { extend : 'Ext.data.Store' ...
- shell 脚本之if、for、while语句
(1)if语句 root@ubuntu:/mnt/shared/shellbox/shellif# cat shellif.sh #!/bin/bash #推断字符串 if [ "$1&qu ...