问题叙述性说明

通过运行“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/" 解的更多相关文章

  1. httpclient提示Cookie rejected: violates RFC 2109: domain must start with a dot

    使用httpclient时发生如下告警信息: WARN - HttpMethodBase.processResponseHeaders(1505) | Cookie rejected: "$ ...

  2. HttpClient3.1 警告: Cookie rejected:

    四月 , :: 下午 org.apache.commons.httpclient.HttpMethodBase processCookieHeaders 警告: Cookie rejected: : ...

  3. 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 ...

  4. python:PATH、PYTHONPATH 和 sys.path 的区别

    python:PATH.PYTHONPATH 和 sys.path 的区别 共同点 所有在它们的路径里面的 moduel 都可以被 import PATH 在 PATH 中的一些命令,例如 *.exe ...

  5. 安装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 " ...

  6. 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 ...

  7. 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 ...

  8. python3 os.path.realpath(__file__) 和 os.path.cwd() 方法的区别

    python3 os.path.realpath(__file__) 和 os.path.cwd() 方法的区别 os.path.realpath 获取当前执行脚本的绝对路径. os.path.rea ...

  9. 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.问题是找不到内核头文件,需要 ...

随机推荐

  1. 免费git服务器以及使用过程中遇到的问题

    1. git rm *,git pull会先git fetch后再git merge,更安全的做法是git fetch修改后再push:git remote rm origin 2. https:// ...

  2. Wix学习整理(4)——关于WiX文件格式和案例HelloWorld的分析

    原文:Wix学习整理(4)--关于WiX文件格式和案例HelloWorld的分析 关于WiX文件格式 .wxs是WiX的源文件扩展名..wxs文件以类XML文件的格式来指定了要构造Windows In ...

  3. POJ 2948 DP

    一个row*col的矩阵,每一个格子内有两种矿yeyenum和bloggium,而且知道它们在每一个格子内的数量是多少.最北边有bloggium的收集站,最西边有 yeyenum 的收集站.如今要在这 ...

  4. SE 2014年5月8日

    两企业接入到 Internet(A公司和B公司),企业内部的用户及服务器均能够访问到 Internet. 2. A公司规模较大,采用了接入层/汇聚层/核心层的划分模式,接入层划分了多vLan(如图), ...

  5. 使用Ambari快速部署Hadoop大数据环境

    使用Ambari快速部署Hadoop大数据环境   发布于2013-5-24   前言 做大数据相关的后端开发工作一年多来,随着Hadoop社区的不断发展,也在不断尝试新的东西,本文着重来讲解下Amb ...

  6. 使用NFS安装oracle软件

    昨天.使用openfiler创建nas存储系统,安装oracle软件,在所有正面最好,要创建一个数据库时报ora错,原来使用nfs安装oracle数据库,mount选项有特殊要求,如以下.以备查: R ...

  7. 网络安全之IP伪造

    眼下非常多站点的涉及存在一些安全漏洞,黑客easy使用ip伪造.session劫持.xss攻击.session注入等手段危害站点安全.在纪录片<互联网之子>(建议搞IT的都要看下)中.亚伦 ...

  8. Android至ViewPager添加切换动画——使用属性动画

    转载请注明出处:http://blog.csdn.net/allen315410/article/details/44200623 ViewPager作为Android最经常使用的的组件之中的一个.相 ...

  9. linux下Oracle11g RAC搭建(九)

    linux下Oracle11g RAC搭建(九) 八.创建ASM仓储 相同在图形化界面操作 [root@node1 ~]#  su - grid [grid@node1 ~]$ asmca   //创 ...

  10. hash在Coreseek 中配置bigint

    304 $sphinxapi->SetSelect('id, domain_hash'); 304 $sphinxapi->SetConnectTimeout(3); 305 $sphin ...