X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mods%2Fsample-nginx-reverse-proxy.config;h=e5faa64034d89adedb13fca06c04c110f6b89380;hb=cf78f1baea70661b48f028bff399818c9aa44fa4;hp=fbbbc488026aaaff31991b1a9d2fa2af4fc2bccd;hpb=e2f8673076165c402782332b42ee744b1ffc7969;p=friendica.git diff --git a/mods/sample-nginx-reverse-proxy.config b/mods/sample-nginx-reverse-proxy.config index fbbbc48802..e5faa64034 100644 --- a/mods/sample-nginx-reverse-proxy.config +++ b/mods/sample-nginx-reverse-proxy.config @@ -6,8 +6,34 @@ # Please refer to NGINX docs # +# Note provided by Gabe R.: if you are using nginx as proxy server for Apache2 +# make sure your nginx config DOES NOT contain the following +# ----- +# location ~ /.well-known { +# allow all; +# } +# ----- ... + +## +# by https://syshero.org/2018-04-13-nginx-unique-request-identifier/ +# if X-Request-ID is set, NGINX will forward the same value to the next upstream +# if the header is not set, NGINX will generate a random request identifier and add it to the request. +# +# To guarantee backward compatibility, map to format the $request_id variable to a format that matches any old setups. +## + +map $request_id $formatted_id { + "~*(?[0-9a-f]{8})(?[0-9a-f]{4})(?[0-9a-f]{4})(?[0-9a-f]{4})(?.*)$" "${p1}-${p2}-${p3}-${p4}-${p5}"; +} + +map $http_x_request_id $uuid { + default "${request_id}"; + ~* "${http_x_request_id}"; +} + + server { ... @@ -23,6 +49,7 @@ server { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Forwarded "for=$proxy_add_x_forwarded_for; proto=$scheme"; + proxy_set_header X-Request-ID $uuid; } ...