nginx-location

NGINX: Obfuscate password in access_log

試著忘記壹切 提交于 2020-02-06 06:39:09
问题 The bounty expires in 2 days . Answers to this question are eligible for a +50 reputation bounty. Jon Mitten is looking for a canonical answer : “This is a common requirement for cloud debugging, and the regex pattern would be very valuable.” I want to log the $request_body in the access logs. But some of the requests have some JSON fields that are sensitive like passwords. Example: [2019-03-28] 201 - POST /api/user/add HTTP/1.1 - {\x22email\x22:\x22test@test.com\x22,\x22password\x22:

nginx in docker proxy path to subdomain

此生再无相见时 提交于 2020-01-25 07:55:25
问题 What I want is to forward all requests made for: www.domain.com/ api /whaterver/comes/next to -> api .domain.com/whatever/comes/next The reason is to avoid browser CORS for www.domain.com requesting to api.domain.com Probably worth mentioning that nginx is running in a Docker container. I am trying to accomplish with the location block below, but it fails: server { listen 8443 ssl; server_name domain.com www.domain.com; index index.php index.html; root /var/www/base/public; location ~ ^/api/(

How to set Nginx URI to fix empty URI in redirect to named location

泪湿孤枕 提交于 2020-01-15 01:08:40
问题 The problem: when accessing our website with an invalid URL that contains a '%' sign, Nginx throws a 400 Bad Request error. Instead of the Nginx page, we would like to rewrite the request to a (WordPress) 404 page. I have tried the following: location @400 { rewrite ^ /404 break; } error_page 400 =307 @400; However, this generates a 500 Internal Server Error on Nginx. Nginx error log says: '... empty URI in redirect to named location "@400" while reading client request line..., request: "GET

configure nginx to make a background request

荒凉一梦 提交于 2020-01-13 05:58:26
问题 I am building an application where I need to do some analytics on the api-data combination usage. Below is my nginx configuration - location /r/ { rewrite /r/(.*)$ http://localhost:3000/sample/route1/$1 redirect; post_action /aftersampleroute1/$1; } location /aftersampleroute1/ { rewrite /aftersampleroute1/(.*) /stats/$1; proxy_pass http://127.0.0.1:3000; } location /r/ is used to redirect the browser request http://localhost:80/r/quwjDP4us to api /sample/route1/quwjDP4us which uses the id

configure nginx to make a background request

删除回忆录丶 提交于 2020-01-13 05:58:06
问题 I am building an application where I need to do some analytics on the api-data combination usage. Below is my nginx configuration - location /r/ { rewrite /r/(.*)$ http://localhost:3000/sample/route1/$1 redirect; post_action /aftersampleroute1/$1; } location /aftersampleroute1/ { rewrite /aftersampleroute1/(.*) /stats/$1; proxy_pass http://127.0.0.1:3000; } location /r/ is used to redirect the browser request http://localhost:80/r/quwjDP4us to api /sample/route1/quwjDP4us which uses the id

Nginx Angular2/Angular routes

纵然是瞬间 提交于 2020-01-02 00:58:12
问题 I have an Angular2/Angular app running inside a docker container and using nginx to serve it. So my app base = /myapp/. Everything works correctly when hitting the app using the base url i.e. www.server.com/myapp or www.server.com/myapp/ events { worker_connections 4096; ## Default: 1024 } http { include /etc/nginx/conf/*.conf; server { listen 80 default_server; root /usr/share/nginx/html; index index.html index.htm; include /etc/nginx/mime.types; underscores_in_headers on; location /myapp {

How to set up nodejs + nginx on windows 8

时光总嘲笑我的痴心妄想 提交于 2019-12-25 07:15:08
问题 I am using nodejs + nginx on windows 8 following This tutorial and set up using this link i am getting " Hello World " at port " http://127.0.0.1:3000/" and at port "3000" but at "http://robstodo.com/" its not working as i write command for start nginx server :- start nginx only black screen is blinking , How i can know my app is running on nginx server ? and in which file should i change. Its my server.js var http = require('http'); http.createServer(function (req, res) { res.writeHead(200,

Using Nginx with Nextcloud/Website/Paperwork parallel

余生颓废 提交于 2019-12-24 10:14:09
问题 I am trying to run Nextcloud,a Homepage and Paperwork under different locations, but can't figure out how to configure my nginx-config correctly. My working tree looks like this: /var/www/ |-> website |-> nextcloud |-> paperwork My Homepage is reachable through web.domain.com and my Nextcloud ist reachable with cloud.domain.com. Now i want to get Paperwork to be reachable under web.domain.com/notes. The index.php of Paperwork lies in the subfolder "paperwork/frontend/public". This is my

nginx try_files with add_header

巧了我就是萌 提交于 2019-12-24 07:58:22
问题 Can someone explain this? I have an nginx server block with this snippet in it: location / { try_files $uri $uri/ /index.html; } Basically, I'm using this to serve an Angular SPA. It works well and great. Now I wanted to append Access-Control-Allow-Origin header to the response. So I changed the block like so: location / { if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Max-Age' 1728000; return 204; } if ($request_method = 'GET') {

How to use try_files with 2 or more roots

孤街浪徒 提交于 2019-12-23 17:17:55
问题 I have looked hi and low and found no such implementation and am wondering if what I am trying is even possible. I have 3 relative paths that serve up static content: Path1: /usr/local/www/style1/static/... Path2: /usr/local/www/style2/static/... Path3: /usr/local/www/style3/static/... The 3 different roots are static unto themselves but the content from /static on down is only semi-static (might be a bit different depending on the exact file being served up and may exist in one path and not