Problems with proxy-mode

I need to connect to the internet using a proxy, which requires authentication. I’ve tried the configuration as suggested by the proxy-mode description:

(define-configuration nyxt/proxy-mode:proxy-mode
  ((nyxt/proxy-mode:proxy (make-instance 'proxy
                                         :url (quri:uri "http://myusername:mypassword@my.proxy.server:8080")
                                         :allowlist '("localhost" "localhost:8080")
                                         :proxied-downloads-p t))))

(define-configuration web-buffer
  ((default-modes (append '(proxy-mode) %slot-default%))))

I don’t manage to get a connection through the proxy. The error message nyxt displays doesn’t say much, even when I enable verbose output only see that the connection failed.

The same proxi uri works for wget.

Any hints?

I’m running on Ubuntu 18.04, nyxt installed from the “all distributions” package.

Relevant discussion is Question : how to set the proxy · Issue #1088 · atlas-engineer/nyxt · GitHub.

Do you have a space or any other URL-encodable character in your username/password? You might need to URL-encode it then. WebKit doesn’t give us much pointers there.

No. Both username and password are plain alphanumeric without spaces.

Is it a socks proxy? It may well be that WebKit doesn’t recognize http proxies (although I was sure it does). If it’s a socks proxy, they you may try adding socks(4|5)?:// instead of http://.

To better nail down the problem I now connected to another proxy which allows me to access some sites without authentication.

It’s an http-Proxy, url set to http : // ip.address:3128.

I can now access
http://deb.debian.org
but not
https://deb.debian.org

The proxy logs a succesful CONNECT for deb . debian . org, but nyxt says the pages cannot be loaded.

Now tried again with the authenticating proxy. When I try to load the page through http, I get a message displayed from the proxy saying that authentication is required. Looks like WebKit does not use the credentials provided correctly.

So to sum up, there seem to be two problems:

  • https traffic through an http proxy is not working
  • proxy authentication is not working

… a few minutes later, without me having changed any part of the configuration, things started working suddenly - including https traffic over the authenticating proxy.

It’s inconvenient that my password gets logged with every request though.

After a restart of nyxt I’m back in the following situation:

  • access to http sites via the authenticated proxy works
  • access to https sites through the proxy does not work
  • local traffic works (both http and https)

I’ve never gotten that deep into fighting with WebKit, so I’m afraid I cannot help much here :frowning:

Figured out the reason for my new problems. proxy-mode wasn’t actually activated any more.

I had changed my configuration to read:

(define-configuration web-buffer
  ((default-modes (append '(proxy-mode) %slot-default%))))

(define-configuration web-buffer
  ((default-modes (append '(force-https-mode) %slot-default%))))

I had misunderstood “append” to add the force-https-mode to my default modes. Appearantly it overrides them, so proxy-mode wasn’t activated any more.

The http://deb.debian.org had been cached by nyxt, so it loaded even with the proxy disabled. Seems like nyxt didn’t cache the https version of it, so I couldn’t load that.

So, with the config change to

(define-configuration web-buffer
  ((default-modes (append '(proxy-mode)
			  '(force-https-mode)
			  '(reduce-tracking-mode) %slot-default%))))

things work perfectly now (through authenticated http proxy).

Hm, yet another misunderstanding of how define-configuration stacks up. @ambrevar, our model is not intuitive enough :smiley:

I see, but how can we solve this?

On the one hand, the naming should be clear enough: it’s the slot defaults we are appending to, not the last value.

On the other hand, it’s easy to see how it’s tempting to want to append when the slot value is a list.

Ultimately, I believe the right “fix” is to provide a graphical user interface.

In the mean time, does any one have an API improvement suggestion?
I’m working on a rewrite of defclass-star, so it’s the perfect time!

Not the proper fix, but a good start: warn the user if the same slot is being overriden more than once.

OK. Off the top of my head, to implement it we traverse the list of superclasses except the original one, and see if the slot is already set there.