Merge branch 'master' into taigafix
This commit is contained in:
commit
a188404219
|
@ -47,6 +47,17 @@ nginx_http_gzip_types: 'text/plain text/css application/json application/x-javas
|
||||||
nginx_http_gzip_vary: 'on'
|
nginx_http_gzip_vary: 'on'
|
||||||
nginx_http_gzip_disable: '"msie6"'
|
nginx_http_gzip_disable: '"msie6"'
|
||||||
|
|
||||||
|
## Self signed certificates
|
||||||
|
nginx_selfsigned_deps:
|
||||||
|
- build-essential
|
||||||
|
- libssl-dev
|
||||||
|
- libffi-dev
|
||||||
|
- python-dev
|
||||||
|
- git
|
||||||
|
- dialog
|
||||||
|
- libaugeas0
|
||||||
|
- ca-certificates
|
||||||
|
|
||||||
nginx_gen_dh: 'false'
|
nginx_gen_dh: 'false'
|
||||||
nginx_dh_path: '{{ nginx_ssl_dir }}/dhparam.pem'
|
nginx_dh_path: '{{ nginx_ssl_dir }}/dhparam.pem'
|
||||||
nginx_dh_length: 4096
|
nginx_dh_length: 4096
|
||||||
|
|
|
@ -49,6 +49,27 @@
|
||||||
when: item.copy_ssl is defined
|
when: item.copy_ssl is defined
|
||||||
notify: reload nginx
|
notify: reload nginx
|
||||||
|
|
||||||
|
- name: "[SELFSIGNED] - Install dependencies"
|
||||||
|
apt:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
with_items: "{{ nginx_selfsigned_deps }}"
|
||||||
|
when: item.selfsigned is defined and item.selfsigned == 'true'
|
||||||
|
|
||||||
|
- name: "[SELFSIGNED] - Add python2 cryptography module"
|
||||||
|
apt:
|
||||||
|
name: python-cryptography
|
||||||
|
state: present
|
||||||
|
with_items: "{{ nginx_vhosts }}"
|
||||||
|
when: item.selfsigned is defined and item.selfsigned == 'true' and ansible_python.executable == '/usr/bin/python'
|
||||||
|
|
||||||
|
- name: "[SELFSIGNED] - Add python3 cryptography module"
|
||||||
|
apt:
|
||||||
|
name: python3-cryptography
|
||||||
|
state: present
|
||||||
|
with_items: "{{ nginx_vhosts }}"
|
||||||
|
when: item.selfsigned is defined and item.selfsigned == 'true' and ansible_python.executable == '/usr/bin/python3'
|
||||||
|
|
||||||
- name: "[SELFSIGNED] - Create Key folder"
|
- name: "[SELFSIGNED] - Create Key folder"
|
||||||
file:
|
file:
|
||||||
path: "{{ nginx_ssl_dir }}/{{ item.ssl_name }}"
|
path: "{{ nginx_ssl_dir }}/{{ item.ssl_name }}"
|
||||||
|
@ -57,31 +78,30 @@
|
||||||
with_items: "{{ nginx_vhosts }}"
|
with_items: "{{ nginx_vhosts }}"
|
||||||
when: item.selfsigned is defined and item.selfsigned == 'true'
|
when: item.selfsigned is defined and item.selfsigned == 'true'
|
||||||
notify: reload nginx
|
notify: reload nginx
|
||||||
|
|
||||||
|
|
||||||
- name: '[SELFSIGNED] - Create a self-signed key'
|
- name: '[SELFSIGNED] - Create a self-signed key'
|
||||||
openssl_privatekey:
|
openssl_privatekey:
|
||||||
path: '{{ ssl_src_path }}/{{ item.ssl_name }}/privkey.pem'
|
path: '{{ ssl_src_path }}/{{ item.ssl_name }}/privkey.pem'
|
||||||
size: 2048
|
size: 2048
|
||||||
type: RSA
|
type: RSA
|
||||||
with_items: "{{ nginx_vhosts }}"
|
with_items: "{{ nginx_vhosts }}"
|
||||||
when: item.selfsigned is defined and item.state == 'enable' and item.selfsigned == 'true'
|
when: item.selfsigned is defined and item.state == 'enable' and item.selfsigned == 'true'
|
||||||
notify: reload nginx
|
notify: reload nginx
|
||||||
|
|
||||||
- name: '[SELFSIGNED] - Generate OpenSSL Certificate Signing Request (CSR)'
|
- name: '[SELFSIGNED] - Generate OpenSSL Certificate Signing Request (CSR)'
|
||||||
openssl_csr:
|
openssl_csr:
|
||||||
path: '{{ ssl_src_path }}/{{ item.ssl_name }}/selfsigned.crs'
|
path: '{{ ssl_src_path }}/{{ item.ssl_name }}/selfsigned.crs'
|
||||||
privatekey_path: '{{ ssl_src_path }}/{{ item.ssl_name }}/privkey.pem'
|
privatekey_path: '{{ ssl_src_path }}/{{ item.ssl_name }}/privkey.pem'
|
||||||
with_items: "{{ nginx_vhosts }}"
|
with_items: "{{ nginx_vhosts }}"
|
||||||
when: item.selfsigned is defined and item.state == 'enable' and item.selfsigned == 'true'
|
when: item.selfsigned is defined and item.state == 'enable' and item.selfsigned == 'true'
|
||||||
notify: reload nginx
|
notify: reload nginx
|
||||||
|
|
||||||
- name: '[SELFSIGNED] - Create a self-signed certificate'
|
- name: '[SELFSIGNED] - Create a self-signed certificate'
|
||||||
openssl_certificate:
|
openssl_certificate:
|
||||||
path: '{{ ssl_src_path }}/{{ item.ssl_name }}/fullchain.pem'
|
path: '{{ ssl_src_path }}/{{ item.ssl_name }}/fullchain.pem'
|
||||||
privatekey_path: '{{ ssl_src_path }}/{{ item.ssl_name }}/privkey.pem'
|
privatekey_path: '{{ ssl_src_path }}/{{ item.ssl_name }}/privkey.pem'
|
||||||
csr_path: '{{ ssl_src_path }}/{{ item.ssl_name }}/selfsigned.crs'
|
csr_path: '{{ ssl_src_path }}/{{ item.ssl_name }}/selfsigned.crs'
|
||||||
provider: selfsigned
|
provider: selfsigned
|
||||||
with_items: "{{ nginx_vhosts }}"
|
with_items: "{{ nginx_vhosts }}"
|
||||||
when: item.selfsigned is defined and item.state == 'enable' and item.selfsigned == 'true'
|
when: item.selfsigned is defined and item.state == 'enable' and item.selfsigned == 'true'
|
||||||
notify: reload nginx
|
notify: reload nginx
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
{% extends "core.j2" %}
|
||||||
|
|
||||||
|
{% block location %}
|
||||||
|
|
||||||
|
root {{ item.root }};
|
||||||
|
|
||||||
|
index index.html index.htm index.php;
|
||||||
|
|
||||||
|
charset utf-8;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prevent Direct Access To Protected Files
|
||||||
|
location ~ \.(env|log) {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prevent Direct Access To Protected Folders
|
||||||
|
location ~ ^/(^app$|bootstrap|config|database|overrides|resources|routes|storage|tests|artisan) {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prevent Direct Access To modules/vendor Folders Except Assets
|
||||||
|
location ~ ^/(modules|vendor)\/(.*)\.((?!ico|gif|jpg|jpeg|png|js\b|css|less|sass|font|woff|woff2|eot|ttf|svg).)*$ {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 404 /index.php;
|
||||||
|
|
||||||
|
# Pass PHP Scripts To FastCGI Server
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_pass unix:/var/run/php/php{{ php_version }}-fpm.sock; # Depends On The PHP Version
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.(?!well-known).* {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
{% endblock %}
|
|
@ -13,16 +13,27 @@
|
||||||
set $main_domain "{{ item.ssl_name }}";
|
set $main_domain "{{ item.ssl_name }}";
|
||||||
set $sandbox_domain "sandbox.{{ item.ssl_name }}";
|
set $sandbox_domain "sandbox.{{ item.ssl_name }}";
|
||||||
|
|
||||||
|
# By default CryptPad allows remote domains to embed CryptPad documents in iframes.
|
||||||
|
# This behaviour can be blocked by changing $allowed_origins from "*" to the
|
||||||
|
# sandbox domain, which must be permitted to load content from the main domain
|
||||||
|
# in order for CryptPad to work as expected.
|
||||||
|
#
|
||||||
|
# An example is given below which can be uncommented if you want to block
|
||||||
|
# remote sites from including content from your server
|
||||||
|
set $allowed_origins "*";
|
||||||
|
# set $allowed_origins "https://${sandbox_domain}";
|
||||||
|
|
||||||
# CryptPad's dynamic content (websocket traffic and encrypted blobs)
|
# CryptPad's dynamic content (websocket traffic and encrypted blobs)
|
||||||
# can be served over separate domains. Using dedicated domains (or subdomains)
|
# can be served over separate domains. Using dedicated domains (or subdomains)
|
||||||
# for these purposes allows you to move them to a separate machine at a later date
|
# for these purposes allows you to move them to a separate machine at a later date
|
||||||
# if you find that a single machine cannot handle all of your users.
|
# if you find that a single machine cannot handle all of your users.
|
||||||
# If you don't use dedicated domains, this can be the same as $main_domain
|
# If you don't use dedicated domains, this can be the same as $main_domain
|
||||||
# If you do, they'll be added as exceptions to any rules which block connections to remote domains.
|
# If you do, they can be added as exceptions to any rules which block connections to remote domains.
|
||||||
|
# You can find these variables referenced below in the relevant places.
|
||||||
set $api_domain "{{ item.ssl_name }}";
|
set $api_domain "{{ item.ssl_name }}";
|
||||||
set $files_domain "{{ item.ssl_name }}";
|
set $files_domain "{{ item.ssl_name }}";
|
||||||
|
|
||||||
add_header Access-Control-Allow-Origin "*";
|
add_header Access-Control-Allow-Origin "${allowed_origins}";
|
||||||
|
|
||||||
#set $coop '';
|
#set $coop '';
|
||||||
#if ($uri ~ ^\/(sheet|presentation|doc|convert)\/.*$) { set $coop 'same-origin'; }
|
#if ($uri ~ ^\/(sheet|presentation|doc|convert)\/.*$) { set $coop 'same-origin'; }
|
||||||
|
@ -33,14 +44,15 @@
|
||||||
# Enable SharedArrayBuffer in Firefox (for .xlsx export)
|
# Enable SharedArrayBuffer in Firefox (for .xlsx export)
|
||||||
add_header Cross-Origin-Resource-Policy cross-origin;
|
add_header Cross-Origin-Resource-Policy cross-origin;
|
||||||
add_header Cross-Origin-Embedder-Policy require-corp;
|
add_header Cross-Origin-Embedder-Policy require-corp;
|
||||||
|
|
||||||
# any static assets loaded with "ver=" in their URL will be cached for a year
|
# any static assets loaded with "ver=" in their URL will be cached for a year
|
||||||
|
if ($uri ~ ^(\/|.*\/|.*\.html)$) {
|
||||||
|
set $cacheControl no-cache;
|
||||||
|
}
|
||||||
if ($args ~ ver=) {
|
if ($args ~ ver=) {
|
||||||
set $cacheControl max-age=31536000;
|
set $cacheControl max-age=31536000;
|
||||||
}
|
}
|
||||||
if ($uri ~ ^/.*(\/|\.html)$) {
|
|
||||||
set $cacheControl no-cache;
|
|
||||||
}
|
|
||||||
# Will not set any header if it is emptystring
|
# Will not set any header if it is emptystring
|
||||||
add_header Cache-Control $cacheControl;
|
add_header Cache-Control $cacheControl;
|
||||||
|
|
||||||
|
@ -48,6 +60,8 @@
|
||||||
set $styleSrc "'unsafe-inline' 'self' https://${main_domain}";
|
set $styleSrc "'unsafe-inline' 'self' https://${main_domain}";
|
||||||
|
|
||||||
# connect-src restricts URLs which can be loaded using script interfaces
|
# connect-src restricts URLs which can be loaded using script interfaces
|
||||||
|
# if you have configured your instance to use a dedicated $files_domain or $api_domain
|
||||||
|
# you will need to add them below as: https://${files_domain} and https://${api_domain}
|
||||||
set $connectSrc "'self' https://${main_domain} blob: wss://${api_domain} https://${sandbox_domain}";
|
set $connectSrc "'self' https://${main_domain} blob: wss://${api_domain} https://${sandbox_domain}";
|
||||||
|
|
||||||
# fonts can be loaded from data-URLs or the main domain
|
# fonts can be loaded from data-URLs or the main domain
|
||||||
|
@ -61,7 +75,6 @@
|
||||||
set $frameSrc "'self' https://${sandbox_domain} blob:";
|
set $frameSrc "'self' https://${sandbox_domain} blob:";
|
||||||
|
|
||||||
# specifies valid sources for loading media using video or audio
|
# specifies valid sources for loading media using video or audio
|
||||||
#set $mediaSrc "'self' data: * blob: ${main_domain}";
|
|
||||||
set $mediaSrc "blob:";
|
set $mediaSrc "blob:";
|
||||||
|
|
||||||
# defines valid sources for webworkers and nested browser contexts
|
# defines valid sources for webworkers and nested browser contexts
|
||||||
|
@ -75,6 +88,13 @@
|
||||||
# script-src specifies valid sources for javascript, including inline handlers
|
# script-src specifies valid sources for javascript, including inline handlers
|
||||||
set $scriptSrc "'self' resource: https://${main_domain}";
|
set $scriptSrc "'self' resource: https://${main_domain}";
|
||||||
|
|
||||||
|
# frame-ancestors specifies which origins can embed your CryptPad instance
|
||||||
|
# this must include 'self' and your main domain (over HTTPS) in order for CryptPad to work
|
||||||
|
# if you have enabled remote embedding via the admin panel then this must be more permissive.
|
||||||
|
# note: cryptpad.fr permits web pages served via https: and vector: (element desktop app)
|
||||||
|
set $frameAncestors "'self' {{ item.frameancestors | default('https://${main_domain}:') }}";
|
||||||
|
# set $frameAncestors "'self' https: vector:";
|
||||||
|
|
||||||
set $unsafe 0;
|
set $unsafe 0;
|
||||||
# the following assets are loaded via the sandbox domain
|
# the following assets are loaded via the sandbox domain
|
||||||
# they unfortunately still require exceptions to the sandboxing to work correctly.
|
# they unfortunately still require exceptions to the sandboxing to work correctly.
|
||||||
|
@ -95,7 +115,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
# Finally, set all the rules you composed above.
|
# Finally, set all the rules you composed above.
|
||||||
add_header Content-Security-Policy "default-src 'none'; child-src $childSrc; worker-src $workerSrc; media-src $mediaSrc; style-src $styleSrc; script-src $scriptSrc; connect-src $connectSrc; font-src $fontSrc; img-src $imgSrc; frame-src $frameSrc;";
|
add_header Content-Security-Policy "default-src 'none'; child-src $childSrc; worker-src $workerSrc; media-src $mediaSrc; style-src $styleSrc; script-src $scriptSrc; connect-src $connectSrc; font-src $fontSrc; img-src $imgSrc; frame-src $frameSrc; frame-ancestors $frameAncestors";
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block root %}
|
{% block root %}
|
||||||
|
@ -105,9 +125,12 @@
|
||||||
error_page 404 /customize.dist/404.html;
|
error_page 404 /customize.dist/404.html;
|
||||||
|
|
||||||
# Finally, serve anything the above exceptions don't govern.
|
# Finally, serve anything the above exceptions don't govern.
|
||||||
try_files /www/$uri /www/$uri/index.html /customize/$uri;
|
try_files /customize/www/$uri /customize/www/$uri/index.html /www/$uri /www/$uri/index.html /customize/$uri;
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block location%}
|
{% block location%}
|
||||||
|
# The nodejs process can handle all traffic whether accessed over websocket or as static assets
|
||||||
|
# We prefer to serve static content from nginx directly and to leave the API server to handle
|
||||||
|
# the dynamic content that only it can manage. This is primarily an optimization
|
||||||
location ^~ /cryptpad_websocket {
|
location ^~ /cryptpad_websocket {
|
||||||
proxy_pass http://{{ item.proxy_pass }}:3000;
|
proxy_pass http://{{ item.proxy_pass }}:3000;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
@ -135,7 +158,7 @@
|
||||||
# /api/config is loaded once per page load and is used to retrieve
|
# /api/config is loaded once per page load and is used to retrieve
|
||||||
# the caching variable which is applied to every other resource
|
# the caching variable which is applied to every other resource
|
||||||
# which is loaded during that session.
|
# which is loaded during that session.
|
||||||
location ~ ^/api/(config|broadcast).*$ {
|
location ~ ^/api/.*$ {
|
||||||
proxy_pass http://{{ item.proxy_pass }}:3000;
|
proxy_pass http://{{ item.proxy_pass }}:3000;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
@ -152,7 +175,7 @@
|
||||||
# encrypted blobs are immutable and are thus cached for a year
|
# encrypted blobs are immutable and are thus cached for a year
|
||||||
location ^~ /blob/ {
|
location ^~ /blob/ {
|
||||||
if ($request_method = 'OPTIONS') {
|
if ($request_method = 'OPTIONS') {
|
||||||
add_header 'Access-Control-Allow-Origin' '*';
|
add_header 'Access-Control-Allow-Origin' "${allowed_origins}";
|
||||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
|
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
|
||||||
add_header 'Access-Control-Max-Age' 1728000;
|
add_header 'Access-Control-Max-Age' 1728000;
|
||||||
|
@ -160,8 +183,9 @@
|
||||||
add_header 'Content-Length' 0;
|
add_header 'Content-Length' 0;
|
||||||
return 204;
|
return 204;
|
||||||
}
|
}
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
add_header Cache-Control max-age=31536000;
|
add_header Cache-Control max-age=31536000;
|
||||||
add_header 'Access-Control-Allow-Origin' '*';
|
add_header 'Access-Control-Allow-Origin' "${allowed_origins}";
|
||||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Content-Length';
|
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Content-Length';
|
||||||
add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Content-Length';
|
add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Content-Length';
|
||||||
|
@ -172,6 +196,7 @@
|
||||||
# these payloads are unlocked via login credentials. They are mutable
|
# these payloads are unlocked via login credentials. They are mutable
|
||||||
# and are thus never cached. They're small enough that it doesn't matter, in any case.
|
# and are thus never cached. They're small enough that it doesn't matter, in any case.
|
||||||
location ^~ /block/ {
|
location ^~ /block/ {
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
add_header Cache-Control max-age=0;
|
add_header Cache-Control max-age=0;
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +214,7 @@
|
||||||
# The nodejs server has some built-in forwarding rules to prevent
|
# The nodejs server has some built-in forwarding rules to prevent
|
||||||
# URLs like /pad from resulting in a 404. This simply adds a trailing slash
|
# URLs like /pad from resulting in a 404. This simply adds a trailing slash
|
||||||
# to a variety of applications.
|
# to a variety of applications.
|
||||||
location ~ ^/(register|login|settings|user|pad|drive|poll|slide|code|whiteboard|file|media|profile|contacts|todo|filepicker|debug|kanban|sheet|support|admin|notifications|teams|calendar|presentation|doc|form|report|convert)$ {
|
location ~ ^/(register|login|settings|user|pad|drive|poll|slide|code|whiteboard|file|media|profile|contacts|todo|filepicker|debug|kanban|sheet|support|admin|notifications|teams|calendar|presentation|doc|form|report|convert|checkup)$ {
|
||||||
rewrite ^(.*)$ $1/ redirect;
|
rewrite ^(.*)$ $1/ redirect;
|
||||||
}
|
}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
{% extends "core.j2" %}
|
||||||
|
|
||||||
|
{% block root %}
|
||||||
|
root {{ item.root }};
|
||||||
|
index {{ item.index }};
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block location %}
|
||||||
|
|
||||||
|
## LOCATIONS
|
||||||
|
location / {
|
||||||
|
# Add cache for static files
|
||||||
|
if ($request_uri ~* ^/(img|css|font|js)/) {
|
||||||
|
add_header Expires "Thu, 31 Dec 2037 23:55:55 GMT";
|
||||||
|
add_header Cache-Control "public, max-age=315360000";
|
||||||
|
}
|
||||||
|
|
||||||
|
# HTTPS only header, improves security
|
||||||
|
add_header Strict-Transport-Security "max-age=15768000";
|
||||||
|
|
||||||
|
}
|
||||||
|
{% endblock %}
|
|
@ -5,11 +5,6 @@
|
||||||
## LOCATIONS
|
## LOCATIONS
|
||||||
location / {
|
location / {
|
||||||
proxy_pass {{ item.upstream_proto }}://{{ item.upstream_name }}:{{ item.upstream_port}};
|
proxy_pass {{ item.upstream_proto }}://{{ item.upstream_name }}:{{ item.upstream_port}};
|
||||||
# Add cache for static files
|
|
||||||
if ($request_uri ~* ^/(img|css|font|js)/) {
|
|
||||||
add_header Expires "Thu, 31 Dec 2037 23:55:55 GMT";
|
|
||||||
add_header Cache-Control "public, max-age=315360000";
|
|
||||||
}
|
|
||||||
|
|
||||||
# HTTPS only header, improves security
|
# HTTPS only header, improves security
|
||||||
add_header Strict-Transport-Security "max-age=15768000";
|
add_header Strict-Transport-Security "max-age=15768000";
|
||||||
|
|
|
@ -6,15 +6,23 @@
|
||||||
|
|
||||||
{% block location %}
|
{% block location %}
|
||||||
location / {
|
location / {
|
||||||
{% if item.filtron == 'true' %}
|
{% if item.upstream_name is defined %}
|
||||||
proxy_set_header Host $http_host;
|
proxy_pass {{ item.upstream_proto }}://{{ item.upstream_name }}:{{ item.upstream_port }};
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header Host $http_host;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header Connection $http_connection;
|
||||||
proxy_set_header X-Scheme $scheme;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_pass http://127.0.0.1:4004/;
|
proxy_set_header X-Scheme $scheme;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Script-Name {{ searx_app_dir }};
|
||||||
{% else %}
|
{% else %}
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
uwsgi_pass unix:/run/uwsgi/app/searx/socket;
|
uwsgi_pass unix://{{ searx_socket }};
|
||||||
|
uwsgi_param HTTP_HOST $host;
|
||||||
|
uwsgi_param HTTP_CONNECTION $http_connection;
|
||||||
|
uwsgi_param HTTP_X_SCHEME $scheme;
|
||||||
|
uwsgi_param HTTP_X_SCRIPT_NAME {{ searx_app_dir }};
|
||||||
|
uwsgi_param HTTP_X_REAL_IP $remote_addr;
|
||||||
|
uwsgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
}
|
}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue