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

Open
opened 2026-02-15 16:28:04 -05:00 by yindo · 0 comments
Owner

Originally created by @goIntoAction on GitHub (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}'
Originally created by @goIntoAction on GitHub (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 in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ollama/ollama-python#115