The original post: /r/nginx by /u/to_sta on 2024-06-25 19:23:14.
I use NGINX as a reverse proxy and want to add headers to backend requests. But there are no headers added.
Any ideas why and how I could solve this?
I use docker compose and the upstreams are other containers in the network. I think I am missing something here.
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024;
}
http {
types {
text/css css;
}
upstream backend {
server backend:8888;
}
upstream frontend {
server frontend:3333;
}
server {
listen 80;
server_name localhost 127.0.0.1;
location /api {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_redirect default;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
You must log in or register to comment.