Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support in Mycroft-core to use proxy (configuration parameters to use proxy in Mycroft's config file or scripts) #1245

Closed
yannick56 opened this issue Nov 22, 2017 · 6 comments
Assignees

Comments

@yannick56
Copy link

Hello,

Can you add Mycroft's configuration parameters to use proxy in mycroft.conf file and/or scripts ?

I use the latest Mycroft-core source code in git repo.
Without proxy , I can ask question by cli by using the following commands:
./start-mycroft.sh all
./start-mycroft.sh cli

But if I want to use Mycroft-core behind a proxy, it does not work.
I try to use Mycroft with a proxy like this:
export http_proxy=http://proxy_hostname.com:8080
export https_port=http://proxy_hostname.com:8080
./start-mycroft.sh all
./start-mycroft.sh cli

In the cli tool, I have the following error:
00:24:56.519 - root - DEBUG - Connecting proxy...
00:24:56.524 - mycroft.messagebus.client.ws:on_error:70 - ERROR - Exception("Uncaught 'error' event.",)
00:24:56.525 - mycroft.messagebus.client.ws:on_error:71 - WARNING - WS Client will reconnect in 20 seconds.

Then can you add proxy support In Mycroft-core to use Mycroft's configuration parameters for proxy in mycroft.conf file and/or scripts ?
In one location, it will better.
Do you have a workaround for this problem ?

Best regards.

Thank you for your help

@forslund
Copy link
Collaborator

I'm not very good at proxy-related-things but it seems I can get around it by excluding 0.0.0.0 from proxy by editing mycroft/messagebus/client/ws.py Line113 and replace it with

ws.run_forever(http_no_proxy=['http://0.0.0.0'])

This means that the ws connections don't use the proxy at all. Is this acceptable behavior?

@forslund
Copy link
Collaborator

Ok I take it back. It's not quite this simple

@forslund
Copy link
Collaborator

Try this in the command line:
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com,0.0.0.0"

@yannick56
Copy link
Author

yannick56 commented Nov 22, 2017

@forslund

Hello,

Try this in the command line:
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com,0.0.0.0"

IT WORKS !
Thank you

For #1245 (comment)
Yes I think that the file mycroft/messagebus/client/ws.py Line113 need a change ,
maybe add the line ws.run_forever(http_no_proxy=...) for all these values: localhost,127.0.0.1,localaddress,.localdomain.com,0.0.0.0 ?

And the file https://github.com/MycroftAI/mycroft-core/blob/dev/README.md need the following lines
"
if you are behind a proxy without authentication, add the following environment variables:
export http_proxy=http://proxy_hostname.com:proxy_port
export https_port=http://proxy_hostname.com:proxy_port
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com,0.0.0.0"
and
if you are behind a proxy with authentication, add the following environment variables:
export http_proxy=http://user:password@proxy_hostname.com:proxy_port
export https_port=http://user:password@proxy_hostname.com:proxy_port
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com,0.0.0.0"
"

@forslund
Copy link
Collaborator

Wooooo! Nice!

I tried number 2 and did not get it to work directly. I'll do some more research to see if I can figure out the format and get these settings into the config.

In the mean time we'll proceed with number 3. Ping @KathyReid, can you see if this can be added to the documentation and/or the readme here?

@KathyReid
Copy link
Contributor

On it

forslund added a commit that referenced this issue Nov 24, 2017
Added section on proxy authentication config, partially resolves #1245
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants