searxng / searxng-docker

The docker-compose files for setting up a SearXNG instance with docker.
GNU Affero General Public License v3.0
1.21k stars 290 forks source link

Disable TLS in local network #134

Closed ghost closed 1 year ago

ghost commented 1 year ago

My home server isn't connected to the outside so caddy isn't able to generate a certificate for me. Every change I make in the UI redirects me to the HTTPS hostname even though the request came from HTTP. I am unsure how to proceed to make the container usable in my local network. I tried commenting out this line but nothing changed: https://github.com/searxng/searxng-docker/blob/e76656a162c40c04ecc4b119d2a28ec2104c5275/Caddyfile#L36-L37

dalf commented 1 year ago

Add the prefix http:// in front of your hostname here:

https://github.com/searxng/searxng-docker/blob/e76656a162c40c04ecc4b119d2a28ec2104c5275/.env#L6

So for example http://searxng.lan instead of searxng.lan.

See https://caddyserver.com/docs/automatic-https#activation :

Any of the following will prevent automatic HTTPS from being activated, either in whole or in part:

ghost commented 1 year ago

I wasn't able to use .env. No changes to the file affected the stack. Since I'm using portainer I manually added the env variables there but now that I added http:// the home page is broken. There's also this line in the compose that could be causing issues with the hardcoded protocol:

https://github.com/searxng/searxng-docker/blob/e76656a162c40c04ecc4b119d2a28ec2104c5275/docker-compose.yaml#L46 With that said, even when I changed this line to use http:// I would sill be redirected to HTTPS when changing options in the searx UI

edit: After getting rid of the http:// part in the compose file the page showed correctly but again I was redirected to HTTPS after changing configurations in the UI

image

ghost commented 1 year ago

I found the problem. These lines in docker-compose.yaml had no port set, so I was being redirected to :80

    environment:
      - SEARXNG_BASE_URL=http://${SEARXNG_HOSTNAME:-localhost}:8082/

Now the UI redirects me back to the home page. Also I reverted the change to the SEARXING__HOSTNAME variable and set it back to IP only!