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

Please do not append port 80 or 443 when I set a custom host, as this can lead to errors on certain gateways. #222

Open
goIntoAction opened this issue Jul 22, 2024 · 0 comments

Comments

@goIntoAction
Copy link

goIntoAction commented Jul 22, 2024

\ollama_client.py, line 74, in _request
raise ResponseError(e.response.text, e.response.status_code) from None
ollama._types.ResponseError: path location is not configured.

I found that the host was appended with port 80 by the following code in the _client.py file, causing the server gateway forwarding to fail.

def _parse_host(host: Optional[str]) -> str:
  host, port = host or '', 11434
  scheme, _, hostport = host.partition('://')
  if not hostport:
    scheme, hostport = 'http', host
  elif scheme == 'http':
    port = 80
  elif scheme == 'https':
    port = 443

  split = urllib.parse.urlsplit('://'.join([scheme, hostport]))
  host = split.hostname or '127.0.0.1'
  port = split.port or port

  return f'{scheme}://{host}:{port}'
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

1 participant