Cookie rejected: Illegal path attribute "/nexus". Path of origin: "/content/" 解决方案
来源:互联网 发布:c语言getchar和scanf 编辑:程序博客网 时间:2024/06/15 07:53
问题描述
通过执行“mvn clean deploy” 命令 将 Maven 项目发布到 Nexus 私服时,控制台输出了如下警告信息:
[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.jar2015-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 的阿里云服务器上,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,修改后的配置如下:
# Mavenserver { 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 4.5.1出现cookie rejected illegal path attribute
- cookie path
- cookie path
- VS2008升级到VS2010出现“Illegal characters in path.”的解决方案。
- Cookie path 参数
- cookie的path
- cookie默认的path
- cookie的path
- push to origin/master was rejected错误解决方案
- path
- path
- path
- path
- path:
- path
- “path”,
- PATH
- T_S_TAB_PARTITION_ADD_MID和T_S_TAB_PARTITION_DEL_MID
- 模块[LCD]_Android LCD(一):LCD基本原理篇
- 网页设置图标即地址栏图标
- 使用Gson解析复杂的json数据
- unity 脚本的enabled属性设置成false的问题
- Cookie rejected: Illegal path attribute "/nexus". Path of origin: "/content/" 解决方案
- Reader、FileOutputStream
- ndk编译错误:error: 'override' does not name a type
- 微软开源Visual Studio构建工具MSBuild
- C#中对象,对象集合的简单Xml序列化与反序列化(已测试)
- PDF文件转换成PPT方法步骤
- IT名称解释
- localhost 对应IP 127.0.0.1
- 双向循环链表