Issues with url_for

Hi there, I need to build an URL from into a blueprint pointing to another internal endpoint, but when using url_for it doesn’t contain the host on which the server is running, I have to do it manually e.g.

app = Sanic(__name__)
app.config["SERVER_NAME"] = "

Which feels wrong as web services could be dynamically deployed using any random URL.

If I don’t setup manually the hostname I’ll get something like this


I could build manually it doing something like:

def url_for(request, endpoint: str) -> str:
    return f"{request.scheme}://{}/{endpoint}""

But I’m wondering if I’m missing something else or is this a Sanic issue as url_for should be doing that?


Edit: My current workaround:"myprefix.mycallback", _external=True, _server=request.headers.get("host"))

Though I’d insist that this should be done by url_for internally

Linked issue here: #1707