zeroflag opened a new pull request, #786:
URL: https://github.com/apache/knox/pull/786

   ## What changes were proposed in this pull request?
   
   When cookie path scoping is enabled knox will update the Path attribute of 
the cookies with `/gateway/topology_name`.
   This doesn't work when a service is accessed via the default topology name 
(there is no `gateway/topology_name` in the url).
   
   ## How was this patch tested?
   
   Enable cookie scoping + set default topology to sandbox:
   
   ```xml
       <property>
           <name>default.app.topology.name</name>
           <value>sandbox</value>
       </property>
       <property>
           <name>gateway.scope.cookies.feature.enabled</name>
           <value>true</value>
       </property>
   ```
   
   Set service url in sandbox.xml:
   
   ```xml
       <service>
           <role>HIVE</role>
           <url>http://localhost:1701</url>
       </service>
   ```
   
   Set up a test http server:
   
   ```smalltalk
   Teapot on
       GET: '/' -> [:req |  ZnResponse noContent
        addCookie: ((ZnCookie name: 'test' value:'val') path: 
'/original/path'); 
        yourself ];
        start. 
   ```
   
   Unblock cookies in service.xml (data/services/hive/0.13.0/service.xml):
   ```xml
          <param>
               <name>responseExcludeHeaders</name>
               <value>SET-COOKIE;asdfg</value>
         </param>
   ```
   
   Cookie path is updated when using the full URL:
   
   ```
   $ curl -u admin:admin-password -k -v 
https://localhost:8443/gateway/sandbox/hive
   
   < HTTP/1.1 204 No Content
   < Set-Cookie: test=val; Path=/gateway/sandbox/original/path
   ```
   
   Cookie path is not updated when using the default URL:
   
   ```
   $ curl -u admin:admin-password -k -v https://localhost:8443/hive
   
   < HTTP/1.1 204 No Content
   < Set-Cookie: test=val; path=/original/path
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to