skip to Main Content

I have a wordpress website running on a server with apache with a nginx as proxy in front of it.

The site has a plugin which displays the telegram channel in an widget as a iframe, i want to exclude results from this iframe in google search results.

I have tried to add this configuration to nginx.
location ~ /wptelegram { add_header X-Robots-Tag "noindex, nofollow, noarchive, nosnippet"; }

The problem is, now the iframe shows the start page, not the actual telegram widget content.

2

Answers


  1. Chosen as BEST ANSWER

    I have solved this by repeating the proxy config from the proxy location to this location.

    location ~ /wptelegram {
        add_header X-Robots-Tag "noindex, nofollow, noarchive, nosnippet";
        proxy_pass https://111.111.111.111:7081;
        proxy_hide_header 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;
        access_log off;
        proxy_cache_key "$scheme$request_method$host$request_uri";
        proxy_no_cache $no_cache $http_pragma $http_authorization $arg_nocache;
        proxy_cache_bypass $no_cache $http_pragma $http_authorization $arg_nocache;
        proxy_cache example.com_proxy;
        proxy_cache_valid "5";
        proxy_cache_use_stale http_500 http_502 http_503 http_504 updating;
        proxy_cache_background_update on;
    }
    

  2. You could also try allowing everything, except iframes and adjust the selector based in you iframe Id

    location ~ /wptelegram {
      try_files $uri $uri/ /index.html?$args;
      if ($http_user_agent ~* (Baidubot|Googlebot|Bingbot)) {
        # blok crawler for iframes only
        rewrite ^(.+)$ /block.html break;
      }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search