[ 
https://issues.apache.org/jira/browse/KARAF-7674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17695864#comment-17695864
 ] 

Aleksy Wróblewski edited comment on KARAF-7674 at 3/2/23 7:03 PM:
------------------------------------------------------------------

The issue seems to be that there are multiple HttpService vendors in my Karaf,  
sometimes ProxyService receives an instance of 
org.apache.felix.httplite.osgi.HttpServiceImpl and sometimes instance of  
org.apache.felix.http.base.internal.service.PerBundleHttpServiceImpl.

 

If the httplite service is used then the proxy does not work at all and HTTP 
404 is returned.

If PerBundleHttpServiceImpl is used, then the servlet name issue from above 
occurs.

It seems to work fine only if it's using HTTP service from pax web runtime, so 
maybe there should be extra OSGi filtering when ProxyService consumes 
HttpService.


was (Author: JIRAUSER294337):
What also happens is sometimes ProxyServiceImpl receives an instance of 
org.apache.felix.httplite.osgi.HttpServiceImpl and sometimes instance of  
org.apache.felix.http.base.internal.service.PerBundleHttpServiceImpl. If the 
httplite service is used then the proxy does not work at all and HTTP 404 is 
returned. If PerBundleHttpServiceImpl is used, then the servlet name issue from 
above occurs.

 

It seems to work fine if it's using HTTP service from pax web.

> HTTP ProxyServlet cookie name issue
> -----------------------------------
>
>                 Key: KARAF-7674
>                 URL: https://issues.apache.org/jira/browse/KARAF-7674
>             Project: Karaf
>          Issue Type: Bug
>    Affects Versions: 4.4.3
>            Reporter: Aleksy Wróblewski
>            Priority: Major
>
> When using HTTP proxy (via http:proxy-add, or ProxyService, or by setting the 
> proxies in org.apache.karaf.http.core.cfg), I get 
> java.lang.IllegalArgumentException: Cookie name "!Proxy!class 
> org.apache.karaf.http.core.internal.proxy.ProxyServlet_1927919381JSESSIONID" 
> is a reserved token
> at javax.servlet.http.Cookie.<init>([Cookie.java:139|http://cookie.java:139/])
> at 
> org.apache.karaf.http.core.internal.proxy.ProxyServlet.copyProxyCookie([ProxyServlet.java:328|http://proxyservlet.java:328/])
>  
> This makes sense since cookies should not contain whitespace, but looking at 
> the code, the servlet name is used for the cookie prefix:
> {code:java}
>    /**
>      * The string prefixing rewritten cookies.
>      */
>     protected String getCookieNamePrefix() {
>         return "!Proxy!" + getServletConfig().getServletName();
>     }
> {code}
> If I rebuild org.apache.karaf.http locally with the method just being
> {code:java}
> return "!Proxy!{code}
> then the http proxy works fine again.
> I think this assumes that the servlet has a meaningful name, but in my case 
> it's the class name (class 
> org.apache.karaf.http.core.internal.proxy.ProxyServlet). It is a Karaf 
> instance built from karaf-maven-plugin assembly. Maybe it's a matter of 
> jetty.xml or other configuration.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to