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

add X-Robots-Tag noindex, nofollow server-snippet to all ingresses #2867

Merged
merged 4 commits into from
Oct 18, 2021

Conversation

tobybellwood
Copy link
Member

This PR adds a default annotation to all ingresses to prevent robots from crawling development sites.

    {{- if eq .Values.environmentType "development"}}
    nginx.ingress.kubernetes.io/server-snippet: |-
       add_header X-Robots-Tag "noindex, nofollow";
    {{- end }}

A couple of important notes:

  • This only applies to development sites
  • This effectively duplicates the ingress annotation already provided in the nginx images - which may eventually be deprecated. (AFAIK, duplicate X-Robots-Tags are allowed, as long as they don't contradict)
  • This extends the no-robots directive to all ingresses (not just nginx-backed ones)
  • Documentation has been added to warn of setting additional server-snippet annotations in .lagoon.yml, as they will take precedence over the ingress-defined ones, which may inadvertently remove the protection.

We should probably flesh out the annotations tests a bit more to cover this (and other eventualities)

Closes #2865

@tobybellwood tobybellwood added this to the v2.1.0 milestone Oct 15, 2021
@twardnw
Copy link
Contributor

twardnw commented Oct 15, 2021

This really also needs to address autogenerated routes on production environments too, a customer on Lagoon highlighted to me that content on autogenerated routes was being crawled/indexed because of the issue with the current lua script in the nginx images

@tobybellwood
Copy link
Member Author

ah - dang, that's an easy fix then!

I'll leave the development wrapper around the custom-ingress, and remove it for all the templated ones.

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

Successfully merging this pull request may close these issues.

Replace lua scripting for x-robots header with annotation on ingress objects
2 participants