ollama / ollama/ollama-python

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

Open
#222 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.5k
Forks
1.2k
Avg merge
4m
Merged PRs (30d)
1

Description

\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}'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in _client.py at _parse_host, with the failure context from ollama_client.py line 74 and the gateway error shown in the issue. Verify how custom http and https hosts are normalized, then confirm that a custom host is not given an implicit port 80 or 443 when forwarding through the gateway.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.