My Sanic site runs behinds Apache as reverse and listens on https://beta.print-css.rocks
Inside some template I need to construct URLs with the original public URL.
That’s what I get from the request and headers:
(Pdb) pp(dict(request.headers))
{'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'en-US,en;q=0.9,de;q=0.8,fr;q=0.7,pt;q=0.6',
'cache-control': 'max-age=0',
'connection': 'close',
'dnt': '1',
'host': '127.0.0.1:8000',
'referer': 'https://beta.print-css.rocks/lessons',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) '
'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 '
'Safari/537.36',
'x-forwarded-for': '185.236.201.126',
'x-forwarded-host': 'beta.print-css.rocks',
'x-forwarded-server': 'beta.print-css.rocks'}
(Pdb) pp request.url
'http://127.0.0.1:8000/lesson/lesson-chapter-numbering'
Of course I have the host information inside the request but I am missing the request scheme and eventually the port number of the public URL.
Is there some build in functionality for getting of hold the original URL - in this case https://beta.print-css.rocks/lesson/lesson-chapter-numbering
?