redmine-slack icon indicating copy to clipboard operation
redmine-slack copied to clipboard

Add support for connecting to Slack through a proxy

Open ajevic opened this issue 8 years ago • 5 comments

Any idea how to solve it? This plugin is accessing Incoming WebHooks (url), which in my network has to be done through proxy. I am using bitnami redmine image, and I know I had to set up on bunch of places proxy settings (git, curl etc...). Any idea where should I set proxy settings for this plugin (or redmine) in order to give it chance to work? :) I am not familiar either with Ubuntu, Ruby or Redmine ;)

ajevic avatar Aug 24 '16 15:08 ajevic

@ajevic thanks for the reprot! This plugin uses the standard HTTPClient library without any special parameters to connect to Slack. If you need support for this, there's probably a way to have it use a proxy, but I am not familiar enough with Redmine to know how you would set that up. If you are able to find a workaround, please post it here.

sciyoshi avatar Nov 08 '16 04:11 sciyoshi

I edited lib/redmine_slack/listener.rb as following, which worked just fine to me.

--- listener.rb.original        2018-05-17 11:24:50.565061795 +0900
+++ listener.rb 2018-05-17 11:19:23.554062064 +0900
@@ -151,7 +151,8 @@
                end
 
                begin
-                       client = HTTPClient.new
+                       proxy = "http://<your-proxy-url>:<port>"
+                       client = HTTPClient.new(proxy)
                        client.ssl_config.cert_store.set_default_paths
                        client.ssl_config.ssl_version = :auto
                        client.post_async url, {:payload => params.to_json}

veracosta avatar May 17 '18 02:05 veracosta

@veracosta I tried the same thing as you suggested but still not getting slack notification. Background- I am able to send notification to slack from redmine server using curl method. Initially it was not working but then I set proxy and it worked. So I guess there is something to do with proxy in my case.

vivekj11 avatar May 22 '18 09:05 vivekj11

It worked actually. I made some other configuration changes to test. After reverting them to original and updating listener.rb file, notifications start to come. Thanks !!

vivekj11 avatar May 22 '18 10:05 vivekj11

could you make it like you can configure the proxy in settings and then if proxy set - use proxy, if not set - don't use proxy ? This way the proxy is not hardcoded and it would be working for both proxy/noproxy users.

petersutty avatar Jan 28 '20 14:01 petersutty