diff --git a/sanic/request.py b/sanic/request.py index 972f7dbf49..e9b4abc195 100644 --- a/sanic/request.py +++ b/sanic/request.py @@ -519,8 +519,11 @@ def url_for(self, view_name, **kwargs): :rtype: str """ # Full URL SERVER_NAME can only be handled in app.url_for - if "//" in self.app.config.SERVER_NAME: - return self.app.url_for(view_name, _external=True, **kwargs) + try: + if self.app.config.SERVER_NAME: + return self.app.url_for(view_name, _external=True, **kwargs) + except AttributeError: + pass scheme = self.scheme host = self.server_name