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.问题是找不到内核头文件,需要 ...
随机推荐
- TR90眼镜_百度百科
TR90眼镜_百度百科 TR90眼镜
- nginx fastcgi 自定义错误页面
http{ fastcgi_intercept_errors on; error_page 404 /404.html; } fastcgi_intercept_errors on;必须设置 之后通过 ...
- 架设FLASH视频流server心得
什么样的情况下才使用FMS?有下面几种情形的时候,你可能须要用到FMS 1.须要通过Flash Player 播放视频,而视频是以流的方式,而不是http渐进式下载的方式进行播放的时候.渐进式下载就是 ...
- Invalid character constant
Invalid character constant 无效的字符常数 可能是双引号写成了单引号了.
- c++程序猿经典面试题
1.请问i的值会输出什么? #include"iostream.h" int i=1; void main() { int i=i; cout<<i<<en ...
- POJ1182 食物链 【并查集变种】
挺简单的 N个元素扩展为 3*N个 i-A i-B i-C A吃B吃C吃A 挑战程序设计的89面 #include <cstdio> #include <cstdlib> #i ...
- UML它 时序图
在本文中,我们重点谈谈UML时序图,UML包括在主时序图的建模元素:对象(Actor).生命线(Lifeline).聚焦控制(Focusofcontrol).消息(Message)等等. 一.UML时 ...
- 只能从脚本中调用在类定义上有[ScriptService]属性的Web服务问题的解决方案
ajax调用webservice中的接口时, 会出现[只能从脚本中调用在类定义上有[ScriptService]属性的...]的异常. 这是因为, 在.net3.5中, 访问web服务, 要对web服 ...
- Unity3D发布WebPlayer时Failed to download data file解决方案
今天发布WebPlayer时, 发现直接打开html是可以正常运行的, 但是通过iis访问的话就会报错: Failed to download data file. 一开始以为是防火墙, 后来发现不是 ...
- 上门洗车APP --- Androidclient开发 之 项目结构介绍
上门洗车APP --- Androidclient开发 之 项目结构介绍 前言 尽管公司项目较紧,但还是抽空给大家继续更新. o_O"~ 欢迎大家的关注,非常高兴和大家共同学习.前面给大家分 ...