I know there is a similar question, but this question is more specific, because I have nginx server installed, but the location parameters do not affect:
Here is my nginx.conf.erb :
daemon off; #Heroku dynos have at least 4 cores. worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>; events { use epoll; accept_mutex on; worker_connections 1024; } http { gzip on; server_tokens off; log_format l2met 'measure#nginx.service=$request_time request_id=$http_x_request_id'; access_log logs/nginx/access.log l2met; error_log logs/nginx/error.log; include mime.types; default_type application/octet-stream; sendfile on; #Must read the body in 5 seconds. client_body_timeout 5; upstream app_server { server unix:/tmp/nginx.socket fail_timeout=0; } server { listen <%= ENV["PORT"] %>; server_name _; keepalive_timeout 5; # A try to override some pictures in parse # location /parse/files/0B5jvlihE6yxQed1w9vRSRW0DRldy3fbwqaCjpyF/ { # add_header whereamI first; # return 301 http://www.immobleupromotion.com/wp-content/uploads/2016/07/nice-ouest.jpg; # } # location /parse/files/{ # add_header whereamI second; # return 301 http://www.immobleupromotion.com/wp-content/uploads/2016/07/nice-ouest.jpg; # } # location / { # add_header whereamI parent; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # proxy_set_header Host $http_host; # proxy_redirect off; # proxy_pass http://app_server; # } } }
Here is my Procfile:
web: bin/start-nginx ./node_modules/.bin/forever index.js
Here is my index.js (at least the relevant part):
var httpServer = require('http').createServer(app); httpServer.listen('/tmp/nginx.socket', function () { fs.openSync('/tmp/app-initialized', 'w'); });
Last but not least, here are my buildpacks
=== super-project Buildpack URLs 1. https://github.com/heroku/heroku-buildpack-nodejs.git 2. https://github.com/heroku/heroku-buildpack-nginx.git
And the problem is ... it works : the server returns through nginx all the desired answers BUT , basically it should not, because it means that nginx proxy is absolutely useless, and I can not understand why.
Any ideas?
Laurent meyer
source share