Skip to content

Fix/add proxy auth when using fetch#106

Open
LaustDengsoe wants to merge 4 commits intodegoog-org:developfrom
LaustDengsoe:fix/proxy-auth-fetch
Open

Fix/add proxy auth when using fetch#106
LaustDengsoe wants to merge 4 commits intodegoog-org:developfrom
LaustDengsoe:fix/proxy-auth-fetch

Conversation

@LaustDengsoe
Copy link
Copy Markdown

I found that the fetch transport mode didn't work when using a proxy of the format: http://user:pass@proxy:port.
This meant that pressing "Test proxy connection" in the settings would fail, but if the curl transport mode was used, one would still be able to search as per usual. However, if using the fetch transport mode, searching would not work.

I have made an attempt at fixing this, so that the fetch transport mode now supports Basic authentication.
However, these changes are breaking, since the default port is now either 80 or 443 based on the protocol of the proxy.
This is because the new URL(proxyUrl); ignores the default port (i.e. 80 or 443), resulting in url.port being an empty string, which would result in port 8080 being used previously.

Please let me know if I need to change anything! :)

@fccview
Copy link
Copy Markdown
Collaborator

fccview commented May 2, 2026

Oh that's very valid!
I'll merge what I'm working on develop and sort out potential conflicts before merging this in, thank you SO much!

@fccview
Copy link
Copy Markdown
Collaborator

fccview commented May 2, 2026

hey @LaustDengsoe
Can you check this for me?

The breaking change was due to the fact that you were going to port 80 if a port was a number or the protocol was http.

If you passed port 1234 that'd return Number(1234) which is truthy, returning port 80 as a result.

(Number(1234) || url.protocol === 'http') ? '80' : '443'

You want it to be

Number(url.port) || (url.protocol === "http:" ? 80 : 443)

Let me know if it works for you, if you confirm I'll merge, good job overall, this is a great addition ❤️

@LaustDengsoe
Copy link
Copy Markdown
Author

LaustDengsoe commented May 2, 2026

Thanks, what an oversight, sorry xD I can confirm, that it works :)
However, the breaking change lies in fact that the default port is no longer 8080.
Instead, its either port 80 or 443 depending on the protocol.
So, http://example.com/ will have port 80 with this change, but port 8080 in previous versions.

@fccview
Copy link
Copy Markdown
Collaborator

fccview commented May 2, 2026

Oh I see, now I am the one oversighting things hahh

I think it should be fine, but I wanna triple check in the morning, hang in there 😆♥️

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

Successfully merging this pull request may close these issues.

3 participants