Moode Forum
Proxy-Server is required, how deal with it? - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: Proxy-Server is required, how deal with it? (/showthread.php?tid=5996)



Proxy-Server is required, how deal with it? - PatiTati - 12-08-2023

Good morning everyone, Sleepy

I need your help. I have set up a Raspberry Pi with the latest Moode 8.3.6. In the environment in which we use this web radio, a proxy server is required for internet access. Do you have any idea how I can tell the system to go through a defined proxy server every time it accesses the Internet (e.g. CURL of the radio stream)?

If I set global variables that are actually taken into account by cURL, does this also work with Moode Audio?
e.g.
Quote:Using environment variables
Another way to use proxy with curl is to set the environment variables http_proxy and https_proxy
Note that setting proxy using environment variables works only with MacOS and Linux. For Windows, see the next section which explains how to use _curlrc_curlrc file.
If you look at the first part of these variable names,  it clearly shows the protocol for which these proxies will be used. It has nothing to do with the protocol used for the proxy server itself.
  • http_proxy – the proxy will be used to access addresses that use http protocol
  • https_proxy – the proxy will be used to access addresses that use https protocol
Simply set the variables http_proxy to http proxy address and https_proxy to set https proxy address. Open terminal and run these two commands.

I have already set the global varibales but no radio stream is working. The GUI always shows CURL failed and Timeout.

Many thanks in advance for your help.

Regards
Patrick


RE: Proxy-Server is required, how deal with it? - Nutul - 12-08-2023

(12-08-2023, 05:05 AM)PatiTati Wrote: Good morning everyone, Sleepy

I need your help. I have set up a Raspberry Pi with the latest Moode 8.3.6. In the environment in which we use this web radio, a proxy server is required for internet access. Do you have any idea how I can tell the system to go through a defined proxy server every time it accesses the Internet (e.g. CURL of the radio stream)?

If I set global variables that are actually taken into account by cURL, does this also work with Moode Audio?
e.g.
Quote:Using environment variables
Another way to use proxy with curl is to set the environment variables http_proxy and https_proxy
Note that setting proxy using environment variables works only with MacOS and Linux. For Windows, see the next section which explains how to use _curlrc_curlrc file.
If you look at the first part of these variable names,  it clearly shows the protocol for which these proxies will be used. It has nothing to do with the protocol used for the proxy server itself.
  • http_proxy – the proxy will be used to access addresses that use http protocol
  • https_proxy – the proxy will be used to access addresses that use https protocol
Simply set the variables http_proxy to http proxy address and https_proxy to set https proxy address. Open terminal and run these two commands.

I have already set the global varibales but no radio stream is working. The GUI always shows CURL failed and Timeout.

Many thanks in advance for your help.

Regards
Patrick

Maybe I am missing something, but why do you need CURL...?
Can you specify your scenario? Some radio station uri / example?


RE: Proxy-Server is required, how deal with it? - Tim Curtis - 12-08-2023

I don't know whether the libcurl library which MPD uses picks up the environment variables but you could try something like below.

Create the file /etc/environment.d/10-proxy-server.conf containing the two lines below substituting your web proxy IP address and port.

export http_proxy="http://proxy-server-ip:port/"
export https_proxy="http://proxy-server-ip:port/"

Reboot and test


RE: Proxy-Server is required, how deal with it? - PatiTati - 12-08-2023

(12-08-2023, 12:24 PM)Tim Curtis Wrote: I don't know whether the libcurl library which MPD uses picks up the environment variables but you could try something like below.

Create the file /etc/environment.d/10-proxy-server.conf containing the two lines below substituting your web proxy IP address and port.

export http_proxy="http://proxy-server-ip:port/"
export https_proxy="http://proxy-server-ip:port/"

Reboot and test

Thank you for your answer. I have already created under /etc/enviroment following Code: (Placeholder are replaced, just for clarify)

Code:
export http_proxy="http://*Proxy-Name*:*PORT*/"
export https_proxy="http://*Proxy-Name*:*PORT*/"
export no_proxy="localhost, 127.0.0.1"

But I still created the file /etc/environment.d/10-proxy-server.conf for your suggestion and filled it right away.
Unfortunately, the stream of radio stations still does not work after a restart. I can now only retrieve data via the proxy at shell level using Curl.

I found out that you can define a proxy in the mpd.conf in the "input" tab. If I enter the proxy server here, I can receive radio streams. Unfortunately, this file is overwritten and recreated by Moode Audio every time the Raspberry is restarted. Is there a way to add manual configurations to the file an it will remain over reboot?

e.g.
Code:
input {
       plugin "curl"
#       proxy "proxy.isp.com:8080"
#       proxy_user "user"
#       proxy_password "password"
}



RE: Proxy-Server is required, how deal with it? - PatiTati - 12-08-2023

(12-08-2023, 12:08 PM)Nutul Wrote:
(12-08-2023, 05:05 AM)PatiTati Wrote: Good morning everyone, Sleepy

I need your help. I have set up a Raspberry Pi with the latest Moode 8.3.6. In the environment in which we use this web radio, a proxy server is required for internet access. Do you have any idea how I can tell the system to go through a defined proxy server every time it accesses the Internet (e.g. CURL of the radio stream)?

If I set global variables that are actually taken into account by cURL, does this also work with Moode Audio?
e.g.
Quote:Using environment variables
Another way to use proxy with curl is to set the environment variables http_proxy and https_proxy
Note that setting proxy using environment variables works only with MacOS and Linux. For Windows, see the next section which explains how to use _curlrc_curlrc file.
If you look at the first part of these variable names,  it clearly shows the protocol for which these proxies will be used. It has nothing to do with the protocol used for the proxy server itself.
  • http_proxy – the proxy will be used to access addresses that use http protocol
  • https_proxy – the proxy will be used to access addresses that use https protocol
Simply set the variables http_proxy to http proxy address and https_proxy to set https proxy address. Open terminal and run these two commands.

I have already set the global varibales but no radio stream is working. The GUI always shows CURL failed and Timeout.

Many thanks in advance for your help.

Regards
Patrick

Maybe I am missing something, but why do you need CURL...?
Can you specify your scenario? Some radio station uri / example?

cURL and its library is used from MPD inside Moode Audio to retrieve audio information / data from the network / internet. (e.g. Stream Radio)
And if you are in environments that require a web proxy to get Internet access (mostly business environments), you must specify this with every HTTP / HTTPS request that is outgoing from your device. If you do not do this, your HTTP / HTTPS request will go directly to the destination, which is not permitted due to the monitoring and control options of the IT department. Topic: Security in a business network


RE: Proxy-Server is required, how deal with it? - Nutul - 12-08-2023

(12-08-2023, 01:17 PM)PatiTati Wrote: cURL and its library is used from MPD inside Moode Audio to retrieve audio information / data from the network / internet. (e.g. Stream Radio)

Yes, I know, my question was more like "why YOU use curl, from the moment that MPD uses it itself".


RE: Proxy-Server is required, how deal with it? - PatiTati - 12-08-2023

(12-08-2023, 01:21 PM)Nutul Wrote:
(12-08-2023, 01:17 PM)PatiTati Wrote: cURL and its library is used from MPD inside Moode Audio to retrieve audio information / data from the network / internet. (e.g. Stream Radio)

Yes, I know, my question was more like "why YOU use curl, from the moment that MPD uses it itself".

MPD uses it itself thats right. If i start a Radio Stream from Moode Audio GUI i will receive an error like this:


Code:
MPD error
Failed to decode http://mp3channels.webradio.antenne.de/antenne; CURL failed: Connection timed out after 10040 milliseconds

I only use curl via the ssh shell to test the configuration. So to speak, to check whether the proxy settings I have stored also work. and they do. only MPD does not use this configuration. Probably because it gets its proxy information from its own mpd.conf file. That's why I asked Tim Curtis if there is a way to make manual adjustments to the mpd.conf without Moode Audio overwriting it after every restart.


RE: Proxy-Server is required, how deal with it? - Tim Curtis - 12-08-2023

(12-08-2023, 12:59 PM)PatiTati Wrote:
(12-08-2023, 12:24 PM)Tim Curtis Wrote: I don't know whether the libcurl library which MPD uses picks up the environment variables but you could try something like below.

Create the file /etc/environment.d/10-proxy-server.conf containing the two lines below substituting your web proxy IP address and port.

export http_proxy="http://proxy-server-ip:port/"
export https_proxy="http://proxy-server-ip:port/"

Reboot and test

Thank you for your answer. I have already created under /etc/enviroment following Code: (Placeholder are replaced, just for clarify)

Code:
export http_proxy="http://*Proxy-Name*:*PORT*/"
export https_proxy="http://*Proxy-Name*:*PORT*/"
export no_proxy="localhost, 127.0.0.1"

But I still created the file /etc/environment.d/10-proxy-server.conf for your suggestion and filled it right away.
Unfortunately, the stream of radio stations still does not work after a restart. I can now only retrieve data via the proxy at shell level using Curl.

I found out that you can define a proxy in the mpd.conf in the "input" tab. If I enter the proxy server here, I can receive radio streams. Unfortunately, this file is overwritten and recreated by Moode Audio every time the Raspberry is restarted. Is there a way to add manual configurations to the file an it will remain over reboot?

e.g.
Code:
input {
       plugin "curl"
#       proxy "proxy.isp.com:8080"
#       proxy_user "user"
#       proxy_password "password"
}

Ok, interesting. I'll add to the TODO list to provide this option in MPD Config screen.

If you want to persist manual edits to mpd.conf try the developer tweaks feature.
https://moodeaudio.org/forum/showthread.php?tid=5706&pid=47753#pid47753


RE: Proxy-Server is required, how deal with it? - PatiTati - 12-08-2023

(12-08-2023, 01:36 PM)Tim Curtis Wrote: Ok, interesting. I'll add to the TODO list to provide this option in MPD Config screen.

If you want to persist manual edits to mpd.conf try the developer tweaks feature.
https://moodeaudio.org/forum/showthread.php?tid=5706&pid=47753#pid47753

Thank you very much. The developer tweaks feature has worked. I was able to add manual proxy settings to mpd.conf that survive a reboot.
Would be very cool if this proxy configuration were possible directly in the webgui.

Thanks again for your great support here in the forum!