Welcome! Log In Create A New Profile


proxy_pass to specific location

April 16, 2015 12:42PM
Hello everyone!
I have next configuration of my nginx:
## first backend ##
upstream first {
## second backend ##
upstream second {

## config ##
server {
listen ssl spdy;
server_name domain.com

ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_certificate /etc/nginx/ssl/domain.crt;
ssl_certificate_key /etc/nginx/ssl/domain.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;

set $root_path '/var/www/domain';
root $root_path;

access_log /var/log/nginx/domain.access.log main;
error_log /var/log/nginx/domain.error.log warn;

index index.html
charset utf-8;

location / {
proxy_set_header Accept-Encoding "";
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-By $server_addr:$server_port;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://first;
## send traffic to SECOND backend if ip is ##
if ( $remote_addr ~* ) {
proxy_pass http://second;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

location /notification {
proxy_pass http://first/notification;

If I go through backend: - I'm getting the correct answer. But when I go to https://domain.com/notification a have 404 error and nothing proxied.
Please help me to get right conf of NOTIFICATION location.
Thank you!
Subject Author Posted

proxy_pass to specific location

oamakarov April 16, 2015 12:42PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 157
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready