pustelnik opened a new issue, #8632:
URL: https://github.com/apache/incubator-devlake/issues/8632

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   I created new Jira Server connection using 
https://devlake.apache.org/docs/Configuration/Jira/ docs. I need to use 
corporate proxy to access my jira. My jira instance has sso configured. When I 
test connection with proxy I have following error:
   
   `[GIN] 2025/11/03 - 08:08:53 | 200 |   318.61305ms |      172.28.0.8 | POST  
   "/plugins/jira/connections/1/test"
   time="2025-11-03 08:09:01" level=error msg="HTTP 500 error\n\tcaused by: 
attached stack trace\n\t  -- stack trace:\n\t  | 
github.com/apache/incubator-devlake/helpers/pluginhelper/api.(*ApiClient).Do\n\t
  | \t/app/helpers/pluginhelper/api/api_client.go:376\n\t  | 
github.com/apache/incubator-devlake/helpers/pluginhelper/api.(*ApiClient).Get\n\t
  | \t/app/helpers/pluginhelper/api/api_client.go:403\n\t  | 
github.com/apache/incubator-devlake/helpers/pluginhelper/api.NewApiClient\n\t  
| \t/app/helpers/pluginhelper/api/api_client.go:146\n\t  | 
github.com/apache/incubator-devlake/helpers/pluginhelper/api.NewApiClientFromConnection\n\t
  | \t/app/helpers/pluginhelper/api/api_client.go:81\n\t  | 
github.com/apache/incubator-devlake/plugins/jira/api.testConnection\n\t  | 
\t/app/plugins/jira/api/connection_api.go:50\n\t  | 
github.com/apache/incubator-devlake/plugins/jira/api.TestExistingConnection\n\t 
 | \t/app/plugins/jira/api/connection_api.go:158\n\t  | 
github.com/apache/incubator-devlake/se
 rver/api.handlePluginCall.func1\n\t  | \t/app/server/api/router.go:141\n\t  | 
github.com/gin-gonic/gin.(*Context).Next\n\t  | 
\t/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174\n\t  | 
github.com/apache/incubator-devlake/server/api.OAuth2ProxyAuthentication.func1\n\t
  | \t/app/server/api/middlewares.go:95\n\t  | 
github.com/gin-gonic/gin.(*Context).Next\n\t  | 
\t/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174\n\t  | 
github.com/apache/incubator-devlake/server/api.RestAuthentication.func1\n\t  | 
\t/app/server/api/middlewares.go:117\n\t  | 
github.com/gin-gonic/gin.(*Context).Next\n\t  | 
\t/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174\n\t  | 
github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1\n\t  | 
\t/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102\n\t  | 
github.com/gin-gonic/gin.(*Context).Next\n\t  | 
\t/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174\n\t  | 
github.com/gin-gonic/gin.LoggerWithConfig.func1\n\t  | \t/go/pkg/mod/gi
 thub.com/gin-gonic/[email protected]/logger.go:240\n\t  | 
github.com/gin-gonic/gin.(*Context).Next\n\t  | 
\t/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174\n\t  | 
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest\n\t  | 
\t/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:620\n\t  | 
github.com/gin-gonic/gin.(*Engine).ServeHTTP\n\t  | 
\t/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:576\n\t  | 
net/http.serverHandler.ServeHTTP\n\t  | 
\t/usr/local/go/src/net/http/server.go:2936\n\t  | net/http.(*conn).serve\n\t  
| \t/usr/local/go/src/net/http/server.go:1995\n\t  | runtime.goexit\n\t  | 
\t/usr/local/go/src/runtime/asm_amd64.s:1598\n\tWraps: (2) Get 
\"https://my-jira-server.org.com.com/login.jsp?moskipsso=true&os_destination=https%!A(MISSING)%!F(MISSING)%!F(MISSING)my-jira-server.org.com.com%!F(MISSING)rest%!F(MISSING)\":
 **stopped after 10 redirects**\n\tWraps: (3) Get 
\"https://my-jira-server.org.com.com/login.jsp?moskipsso=true&os_destination=https%!A(MISSING)%!F(MISSING)%!
 F(MISSING)my-jira-server.org.com.com%!F(MISSING)rest%!F(MISSING)\"\n\tWraps: 
(4) stopped after 10 redirects\n\tError types: (1) *withstack.withStack (2) 
*errutil.withPrefix (3) *url.Error (4) *errors.errorString"
   [GIN] 2025/11/03 - 08:09:01 | 500 |  241.508463ms |      172.28.0.8 | POST   
  "/plugins/jira/connections/1/test"`
   
   I run the same test on a system with direct access (no proxy required) and 
it worked without issues. After a little debugging I found a root cause. 
https://github.com/apache/incubator-devlake/blob/main/backend/helpers/pluginhelper/api/api_client.go#L146
 sends a rquest to <jira-endpoint> api root, which for my instance looks like 
this:
   GET  https://my-org-jira.com/rest/
   HTTP/2 302 
   
   
   
   ### What do you expect to happen
   
   Jira connection with proxy should be possible. All api's work behind proxy, 
just calling rest endpoint doesn't work. Sending a test request as part of 
client setup leads to unexpected behavior. 
   
   ### How to reproduce
   
   1. Configure connection to Jira Server with sso enabled
   2. Configure http proxy
   3. Test connection
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   v1.0.2
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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