proxy_pass to specific location

oamakarov nginx-forum at
Thu Apr 16 16:42:15 UTC 2015

Hello everyone!
I have next configuration of my nginx:
## first backend ##
upstream first {
## second backend ##
upstream second {

## config ##
server {
        listen ssl spdy;

        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 a have 404 error and nothing proxied. 
Please help me to get right conf of NOTIFICATION location.
Thank you!

Posted at Nginx Forum:,258115,258115#msg-258115

More information about the nginx mailing list