Score:0

How to not redirect if is from social media site with Nginx?

cn flag

How do I not force a redirect if it's from a social media site like reddit,facebook & twitter? Currently my setting is set to redirect any direct access to image files but I don't want to redirect if it's from social media sites so it can fetch image preview.

proxy_cache_path /var/www/img.example.com/htdocs/cache-store levels=1:2 keys_zone=pixstore:10m max_size=5g inactive=7d use_temp_path=off;
server {

    server_name img.example.com www.img.example.com;

    access_log /var/log/nginx/img.example.com.access.log ;
    error_log /var/log/nginx/img.example.com.error.log;

    add_header X-Proxy-Cache $upstream_cache_status;
    location / {
        proxy_cache pixstore;
        proxy_cache_revalidate on;
        proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
        proxy_cache_lock on;
        add_header X-Cache-Status $upstream_cache_status;
        proxy_pass http://xxx.xxx.xxx.xxx:8090;
        proxy_redirect off;
        include proxy_params;
        proxy_cache_valid 200 7d;
        proxy_cache_valid 404 5m;
    }

    location ~ "^/c/600x1200_90_webp/img-master/img/\d+/\d+/\d+/\d+/\d+/\d+/((?<filenum>\d+)[^/]+\.(jpg|png|webp))$" {
    proxy_pass http://xxx.xxx.xxx.xxx:8090;
    return 301 http://view.example.com/artwork/$filenum;
    }

}
djdomi avatar
za flag
we need more specific information about what you want, moreover is there a business for?
us flag
The configuration in your question does not match the "Currently my setting is" statement. Please make sure your question is consistent.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.