forked from zaclys/searxng
Rebrand Zaclys for SearXNG
The `url_for` function in the template context is not the one from Flask, it is
the one from `webapp`. The `webapp.url_for_theme` is different from its
namesake of Flask and has it quirks, when called with argument `_external=True`.
The `webapp.url_for_theme` can't handle absolute URLs since it pokes a leading
'/', here is the snippet of the old code::
url = url_for(endpoint, **values)
if settings['server']['base_url']:
if url.startswith('/'):
url = url[1:]
url = urljoin(settings['server']['base_url'], url)
Next drawback of (Flask's) `_external=True` is, that it will not return the HTTP
scheme when searx (the Flask app) listens on http and is proxied by a https
server.
To get the right scheme `HTTP_X_SCHEME` is needed by Flask (werkzeug). Since
this is not provided in every environment (e.g. behind Apache mod_wsgi or the
HTTP header is not fully set for some other reasons) it is recommended to
get *script_name*, *server* and *scheme* from the configured `base_url`. If
`base_url` is specified, then these values from are given preference over any
Flask's generics.
BTW this patch normalize to use `url_for` in the `opensearch.xml` and drop the
need of `host` and `urljoin` in template's context.
Signed-off-by: Markus Heiser <markus@darmarit.de>
|
||
|---|---|---|
| .github | ||
| dockerfiles | ||
| docs | ||
| examples | ||
| searx | ||
| searx_extra | ||
| tests | ||
| utils | ||
| .codecov.yml | ||
| .config.sh | ||
| .coveragerc | ||
| .dir-locals.el | ||
| .dockerignore | ||
| .gitattributes | ||
| .gitignore | ||
| .landscape.yaml | ||
| .pylintrc | ||
| AUTHORS.rst | ||
| babel.cfg | ||
| CHANGELOG.rst | ||
| CONTRIBUTING.md | ||
| Dockerfile | ||
| LICENSE | ||
| Makefile | ||
| manage.sh | ||
| PULL_REQUEST_TEMPLATE.md | ||
| README.rst | ||
| requirements-dev.txt | ||
| requirements.txt | ||
| setup.py | ||
| tox.ini | ||
Privacy-respecting, hackable metasearch engine / pronunciation səːks.
If you are looking for running instances, ready to use, then visit searx.space.
Otherwise jump to the user, admin and developer handbooks you will find on our homepage.