[jira] [Updated] (KNOX-2953) Uniform name of http method of client metric to lowerCase

2023-08-31 Thread Sandeep More (Jira)


 [ 
https://issues.apache.org/jira/browse/KNOX-2953?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sandeep More updated KNOX-2953:
---
Fix Version/s: 2.1.0
   Resolution: Fixed
   Status: Resolved  (was: Patch Available)

> Uniform name of http method of client metric to lowerCase
> -
>
> Key: KNOX-2953
> URL: https://issues.apache.org/jira/browse/KNOX-2953
> Project: Apache Knox
>  Issue Type: Improvement
>  Components: Metrics
>Reporter: liang.feng
>Priority: Minor
> Fix For: 2.1.0
>
> Attachments: gateway-client-metric.png, 
> gateway-metric-client-after-fix.png
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> The metric name starting with client should set httpMethod to lowercase, when 
> build metric name, just like the service metric name at [#
> [https://github.com/apache/knox/blob/master/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrHttpClientBuilderProvider.java#L68]]
>  
> There are many similar metric names now,due to name of httpMethod is 
> non-uniform. 
> For example:
> When I query from HBase with curl command , The command curl -X Get 和 curl -X 
> GET will generate two similar metric name
> !gateway-client-metric.png!  
> We should uniformly change the method name to lowercase  so that the metric 
> names of service and client are unified.
>  
> The effect after applying the [PR789|https://github.com/apache/knox/pull/789]
> !gateway-metric-client-after-fix.png!



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


[jira] [Commented] (KNOX-2953) Uniform name of http method of client metric to lowerCase

2023-08-31 Thread Sandeep More (Jira)


[ 
https://issues.apache.org/jira/browse/KNOX-2953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17760998#comment-17760998
 ] 

Sandeep More commented on KNOX-2953:


[~a516072575] thank you your patch has been committed. Thank you for your 
contribution!

> Uniform name of http method of client metric to lowerCase
> -
>
> Key: KNOX-2953
> URL: https://issues.apache.org/jira/browse/KNOX-2953
> Project: Apache Knox
>  Issue Type: Improvement
>  Components: Metrics
>Reporter: liang.feng
>Priority: Minor
> Attachments: gateway-client-metric.png, 
> gateway-metric-client-after-fix.png
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> The metric name starting with client should set httpMethod to lowercase, when 
> build metric name, just like the service metric name at [#
> [https://github.com/apache/knox/blob/master/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrHttpClientBuilderProvider.java#L68]]
>  
> There are many similar metric names now,due to name of httpMethod is 
> non-uniform. 
> For example:
> When I query from HBase with curl command , The command curl -X Get 和 curl -X 
> GET will generate two similar metric name
> !gateway-client-metric.png!  
> We should uniformly change the method name to lowercase  so that the metric 
> names of service and client are unified.
>  
> The effect after applying the [PR789|https://github.com/apache/knox/pull/789]
> !gateway-metric-client-after-fix.png!



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


[jira] [Work logged] (KNOX-2953) Uniform name of http method of client metric to lowerCase

2023-08-31 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/KNOX-2953?focusedWorklogId=879421=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-879421
 ]

ASF GitHub Bot logged work on KNOX-2953:


Author: ASF GitHub Bot
Created on: 31/Aug/23 15:30
Start Date: 31/Aug/23 15:30
Worklog Time Spent: 10m 
  Work Description: moresandeep merged PR #789:
URL: https://github.com/apache/knox/pull/789




Issue Time Tracking
---

Worklog Id: (was: 879421)
Time Spent: 20m  (was: 10m)

> Uniform name of http method of client metric to lowerCase
> -
>
> Key: KNOX-2953
> URL: https://issues.apache.org/jira/browse/KNOX-2953
> Project: Apache Knox
>  Issue Type: Improvement
>  Components: Metrics
>Reporter: liang.feng
>Priority: Minor
> Attachments: gateway-client-metric.png, 
> gateway-metric-client-after-fix.png
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> The metric name starting with client should set httpMethod to lowercase, when 
> build metric name, just like the service metric name at [#
> [https://github.com/apache/knox/blob/master/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrHttpClientBuilderProvider.java#L68]]
>  
> There are many similar metric names now,due to name of httpMethod is 
> non-uniform. 
> For example:
> When I query from HBase with curl command , The command curl -X Get 和 curl -X 
> GET will generate two similar metric name
> !gateway-client-metric.png!  
> We should uniformly change the method name to lowercase  so that the metric 
> names of service and client are unified.
>  
> The effect after applying the [PR789|https://github.com/apache/knox/pull/789]
> !gateway-metric-client-after-fix.png!



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


[GitHub] [knox] moresandeep merged pull request #789: KNOX-2953 - Uniform name of http method of client metric to lowerCase

2023-08-31 Thread via GitHub


moresandeep merged PR #789:
URL: https://github.com/apache/knox/pull/789


-- 
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: dev-unsubscr...@knox.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Work logged] (KNOX-2946) Cookie Path Scoping doesn't work when using default topology URL

2023-08-31 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/KNOX-2946?focusedWorklogId=879415=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-879415
 ]

ASF GitHub Bot logged work on KNOX-2946:


Author: ASF GitHub Bot
Created on: 31/Aug/23 15:10
Start Date: 31/Aug/23 15:10
Worklog Time Spent: 10m 
  Work Description: zeroflag commented on code in PR #786:
URL: https://github.com/apache/knox/pull/786#discussion_r1311785341


##
gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/api/CookieScopeServletFilter.java:
##
@@ -43,7 +45,12 @@ public void init( FilterConfig filterConfig ) throws 
ServletException {
   @Override
   protected void doFilter( HttpServletRequest request, HttpServletResponse 
response, FilterChain chain )
   throws IOException, ServletException {
-chain.doFilter(request, new CookieScopeResponseWrapper(response, 
gatewayPath, topologyName));
+if 
("true".equals(request.getAttribute(DEFAULT_TOPOLOGY_FORWARD_ATTRIBUTE_NAME))) {

Review Comment:
   That might be a bit better. I'll modify it.





Issue Time Tracking
---

Worklog Id: (was: 879415)
Time Spent: 40m  (was: 0.5h)

> Cookie Path Scoping doesn't work when using default topology URL
> 
>
> Key: KNOX-2946
> URL: https://issues.apache.org/jira/browse/KNOX-2946
> Project: Apache Knox
>  Issue Type: Bug
>Reporter: Attila Magyar
>Assignee: Attila Magyar
>Priority: Major
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> When gateway.scope.cookies.feature.enabled is turned on, knox will update the 
> Path attribute of the Set-Cookie header to /ctxpath/topology_name/, e.g.: 
> Original:
> Set-Cookie: xxx Path = /
> Updated:
> Set-Cookie: xxx Path = /gateway/cdp-proxy
> However, when the gateway.default.app.topology.name is set to cdp-proxy, and 
> we access a service via the default topology (there is no cdp-proxy in the 
> URL) then the cookie will be blocked by the browser.



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


[GitHub] [knox] zeroflag commented on a diff in pull request #786: KNOX-2946 - Cookie Path Scoping doesn't work when using default topology URL

2023-08-31 Thread via GitHub


zeroflag commented on code in PR #786:
URL: https://github.com/apache/knox/pull/786#discussion_r1311785341


##
gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/api/CookieScopeServletFilter.java:
##
@@ -43,7 +45,12 @@ public void init( FilterConfig filterConfig ) throws 
ServletException {
   @Override
   protected void doFilter( HttpServletRequest request, HttpServletResponse 
response, FilterChain chain )
   throws IOException, ServletException {
-chain.doFilter(request, new CookieScopeResponseWrapper(response, 
gatewayPath, topologyName));
+if 
("true".equals(request.getAttribute(DEFAULT_TOPOLOGY_FORWARD_ATTRIBUTE_NAME))) {

Review Comment:
   That might be a bit better. I'll modify it.



-- 
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: dev-unsubscr...@knox.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Work logged] (KNOX-2946) Cookie Path Scoping doesn't work when using default topology URL

2023-08-31 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/KNOX-2946?focusedWorklogId=879414=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-879414
 ]

ASF GitHub Bot logged work on KNOX-2946:


Author: ASF GitHub Bot
Created on: 31/Aug/23 15:08
Start Date: 31/Aug/23 15:08
Worklog Time Spent: 10m 
  Work Description: zeroflag commented on code in PR #786:
URL: https://github.com/apache/knox/pull/786#discussion_r1311782767


##
gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/CookieScopeResponseWrapper.java:
##
@@ -46,8 +46,8 @@ public CookieScopeResponseWrapper(HttpServletResponse 
response, String gatewayPa
 public void addHeader(String name, String value) {
 if (SET_COOKIE.equals(name)) {
 String updatedCookie;
-if (value.contains(COOKIE_PATH)) {
-updatedCookie = value.replace(COOKIE_PATH, scopePath);
+if (hasCookiePathAttribute(value)) {
+updatedCookie = value.replaceAll("(?i)" + COOKIE_PATH, 
scopePath);

Review Comment:
   `(?i)` makes the regexp case insensitive





Issue Time Tracking
---

Worklog Id: (was: 879414)
Time Spent: 0.5h  (was: 20m)

> Cookie Path Scoping doesn't work when using default topology URL
> 
>
> Key: KNOX-2946
> URL: https://issues.apache.org/jira/browse/KNOX-2946
> Project: Apache Knox
>  Issue Type: Bug
>Reporter: Attila Magyar
>Assignee: Attila Magyar
>Priority: Major
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> When gateway.scope.cookies.feature.enabled is turned on, knox will update the 
> Path attribute of the Set-Cookie header to /ctxpath/topology_name/, e.g.: 
> Original:
> Set-Cookie: xxx Path = /
> Updated:
> Set-Cookie: xxx Path = /gateway/cdp-proxy
> However, when the gateway.default.app.topology.name is set to cdp-proxy, and 
> we access a service via the default topology (there is no cdp-proxy in the 
> URL) then the cookie will be blocked by the browser.



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


[jira] [Work logged] (KNOX-2946) Cookie Path Scoping doesn't work when using default topology URL

2023-08-31 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/KNOX-2946?focusedWorklogId=879413=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-879413
 ]

ASF GitHub Bot logged work on KNOX-2946:


Author: ASF GitHub Bot
Created on: 31/Aug/23 15:05
Start Date: 31/Aug/23 15:05
Worklog Time Spent: 10m 
  Work Description: pzampino commented on code in PR #786:
URL: https://github.com/apache/knox/pull/786#discussion_r1311770180


##
gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/api/CookieScopeServletFilter.java:
##
@@ -43,7 +45,12 @@ public void init( FilterConfig filterConfig ) throws 
ServletException {
   @Override
   protected void doFilter( HttpServletRequest request, HttpServletResponse 
response, FilterChain chain )
   throws IOException, ServletException {
-chain.doFilter(request, new CookieScopeResponseWrapper(response, 
gatewayPath, topologyName));
+if 
("true".equals(request.getAttribute(DEFAULT_TOPOLOGY_FORWARD_ATTRIBUTE_NAME))) {

Review Comment:
   Would 
Boolean.parseBoolean(request.getAttribute(DEFAULT_TOPOLOGY_FORWARD_ATTRIBUTE_NAME))
 be better here?



##
gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/CookieScopeResponseWrapper.java:
##
@@ -46,8 +46,8 @@ public CookieScopeResponseWrapper(HttpServletResponse 
response, String gatewayPa
 public void addHeader(String name, String value) {
 if (SET_COOKIE.equals(name)) {
 String updatedCookie;
-if (value.contains(COOKIE_PATH)) {
-updatedCookie = value.replace(COOKIE_PATH, scopePath);
+if (hasCookiePathAttribute(value)) {
+updatedCookie = value.replaceAll("(?i)" + COOKIE_PATH, 
scopePath);

Review Comment:
   What is being done here?





Issue Time Tracking
---

Worklog Id: (was: 879413)
Time Spent: 20m  (was: 10m)

> Cookie Path Scoping doesn't work when using default topology URL
> 
>
> Key: KNOX-2946
> URL: https://issues.apache.org/jira/browse/KNOX-2946
> Project: Apache Knox
>  Issue Type: Bug
>Reporter: Attila Magyar
>Assignee: Attila Magyar
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> When gateway.scope.cookies.feature.enabled is turned on, knox will update the 
> Path attribute of the Set-Cookie header to /ctxpath/topology_name/, e.g.: 
> Original:
> Set-Cookie: xxx Path = /
> Updated:
> Set-Cookie: xxx Path = /gateway/cdp-proxy
> However, when the gateway.default.app.topology.name is set to cdp-proxy, and 
> we access a service via the default topology (there is no cdp-proxy in the 
> URL) then the cookie will be blocked by the browser.



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