Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

could not find named location #25

Closed
mark-hahn opened this issue Dec 1, 2011 · 2 comments
Closed

could not find named location #25

mark-hahn opened this issue Dec 1, 2011 · 2 comments

Comments

@mark-hahn
Copy link

I'm getting this error: could not find named location "http://localhost:81". The value, http://localhost:81, is the identical location I use for proxy_pass and it works fine.

My full config is:

server {
    listen       80;

    location ~* \/(favicon.ico$|apple-tou.*|robots.txt$) {
        root /ria/src/views/images/favicons;
    } 

    location ~ /(common/|views/(js|css)/|views/images/|views/pages/[^/]+_client\.js$|notification/images/).* {
        root /ria/src;
    }

    location ~ \/ria\/.*(\.jpg|\.jpeg|\.gif|\.png)$$ {
        proxy_pass          http://localhost:5984;
        proxy_set_header    X-Real-IP  $remote_addr;
        proxy_set_header    Authorization "Basic cm9vdDp0Ymdjb21wczI=";
    }

    location / {
        proxy_pass          http://localhost:81;
        proxy_set_header    X-Real-IP  $remote_addr;
    }

    location /upload {
        client_max_body_size    0;
        upload_max_file_size    0;
        upload_pass             http://localhost:81;
        upload_store            /mnt/uploads 1;

        upload_set_form_field $upload_field_name.name "$upload_file_name";
        upload_set_form_field $upload_field_name.path "$upload_tmp_path";
        upload_aggregate_form_field "$upload_field_name.sha1" "$upload_file_sha1";
        upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";
        #upload_pass_form_field "^fallback$|^login$|^usession$";
        upload_cleanup 400 404 499 500-505;
    }

    # Stop Image and Document Hijacking
    location ~* (\.jpg|\.jpeg|\.gif|\.png)$ {
        if ($http_referer !~ ^(https?:\/\/[^\/]*comps2.info) ) {
            return 444;
        }
    }

    error_page 500 502 503 504  /50x.html;
    location = /50x.html {
        root   /ria/etc/nginx/html;
    }
    #error_page  404              /404.html;
    #charset koi8-r;
}
@mark-hahn
Copy link
Author

I fixed the problem by using a location of '/', which is then handled by proxy_pass. This should be documented somewhere.

@vkholodkov
Copy link
Collaborator

Only realtive paths can be used as the argument of upload_pass directive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants