|
| 1 | +{ |
| 2 | + admin off |
| 3 | + |
| 4 | + log { |
| 5 | + output stderr |
| 6 | + format filter { |
| 7 | + # Preserves first 8 bits from IPv4 and 32 bits from IPv6 |
| 8 | + request>remote_ip ip_mask 8 32 |
| 9 | + request>client_ip ip_mask 8 32 |
| 10 | + |
| 11 | + # Remove identificable information |
| 12 | + request>remote_port delete |
| 13 | + request>headers delete |
| 14 | + request>uri query { |
| 15 | + delete url |
| 16 | + delete h |
| 17 | + delete q |
| 18 | + } |
| 19 | + } |
| 20 | + } |
| 21 | +} |
| 22 | + |
| 23 | +{$SEARXNG_HOSTNAME} |
| 24 | + |
| 25 | +tls {$SEARXNG_TLS} |
| 26 | + |
| 27 | +encode zstd gzip |
| 28 | + |
| 29 | +@api { |
| 30 | + path /config |
| 31 | + path /healthz |
| 32 | + path /stats/errors |
| 33 | + path /stats/checker |
| 34 | +} |
| 35 | + |
| 36 | +@search { |
| 37 | + path /search |
| 38 | +} |
| 39 | + |
| 40 | +@imageproxy { |
| 41 | + path /image_proxy |
| 42 | +} |
| 43 | + |
| 44 | +@static { |
| 45 | + path /static/* |
| 46 | +} |
| 47 | + |
| 48 | +header { |
| 49 | + # CSP (https://content-security-policy.com) |
| 50 | + Content-Security-Policy "upgrade-insecure-requests; default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; form-action 'self' https://github.com/searxng/searxng/issues/new; font-src 'self'; frame-ancestors 'self'; base-uri 'self'; connect-src 'self' https://overpass-api.de; img-src * data:; frame-src https://www.youtube-nocookie.com https://player.vimeo.com https://www.dailymotion.com https://www.deezer.com https://www.mixcloud.com https://w.soundcloud.com https://embed.spotify.com;" |
| 51 | + |
| 52 | + # Disable some browser features |
| 53 | + Permissions-Policy "accelerometer=(),camera=(),geolocation=(),gyroscope=(),magnetometer=(),microphone=(),payment=(),usb=()" |
| 54 | + |
| 55 | + # Set referrer policy |
| 56 | + Referrer-Policy "no-referrer" |
| 57 | + |
| 58 | + # Force clients to use HTTPS |
| 59 | + Strict-Transport-Security "max-age=31536000" |
| 60 | + |
| 61 | + # Prevent MIME type sniffing from the declared Content-Type |
| 62 | + X-Content-Type-Options "nosniff" |
| 63 | + |
| 64 | + # X-Robots-Tag (comment to allow site indexing) |
| 65 | + X-Robots-Tag "noindex, noarchive, nofollow" |
| 66 | + |
| 67 | + # Remove "Server" header |
| 68 | + -Server |
| 69 | +} |
| 70 | + |
| 71 | +header @api { |
| 72 | + Access-Control-Allow-Methods "GET, OPTIONS" |
| 73 | + Access-Control-Allow-Origin "*" |
| 74 | +} |
| 75 | + |
| 76 | +route { |
| 77 | + # Cache policy |
| 78 | + header Cache-Control "max-age=0, no-store" |
| 79 | + header @search Cache-Control "max-age=5, private" |
| 80 | + header @imageproxy Cache-Control "max-age=604800, public" |
| 81 | + header @static Cache-Control "max-age=31536000, public, immutable" |
| 82 | +} |
| 83 | + |
| 84 | +# SearXNG (uWSGI) |
| 85 | +reverse_proxy localhost:8080 { |
| 86 | + header_up X-Forwarded-Port {http.request.port} |
| 87 | + header_up X-Real-IP {http.request.remote.host} |
| 88 | + |
| 89 | + # https://github.com/searx/searx-docker/issues/24 |
| 90 | + header_up Connection "close" |
| 91 | +} |
0 commit comments