ingress-gce icon indicating copy to clipboard operation
ingress-gce copied to clipboard

BackendConfig support for user-defined response headers

Open andriymarchuk opened this issue 5 years ago • 23 comments

We have support for user-defined request headers for https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-features#request_headers

Would be great if BackendConfig also had support for user-defined response headers as per https://cloud.google.com/load-balancing/docs/custom-headers#working-with-response

andriymarchuk avatar Sep 23 '20 10:09 andriymarchuk

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Dec 22 '20 11:12 fejta-bot

/remove-lifecycle stale

stevenaldinger avatar Jan 10 '21 21:01 stevenaldinger

Edit: I ended up deploying an nginx sidecar in the pod, used proxy_hide_header Content-Security-Policy; to get rid of what google puts on there, and then added my own.

I'm trying to serve an app (Rocket chat) with ingress-gce/managed certs and need to be able to set content security policy response headers so it can be iframed at another domain. is that possible without this feature or is ingress-gce unusable for that case?

stevenaldinger avatar Jan 10 '21 21:01 stevenaldinger

Hi, any chance to add support for user-defined response headers?

grzegorz655 avatar Mar 04 '21 13:03 grzegorz655

Would love to see this implemented please.

bluemalkin avatar Apr 22 '21 00:04 bluemalkin

Any progress in that?

ivan046 avatar Jun 02 '21 09:06 ivan046

Everyone interested, please, add your stars to the correspondining issue here: https://issuetracker.google.com/issues/191700241 Thanks! It's a really easy-to-imolement feature. Hope will get it soon.

ivan046 avatar Jul 08 '21 11:07 ivan046

Everyone interested, please, add your stars to the correspondining issue here: https://issuetracker.google.com/issues/191700241

That issue is private (or deleted?).

Added a thumb-up on this one. Hoping someone will notice it.


Apparently, this is a dupe of an earlier request: https://github.com/kubernetes/ingress-gce/issues/1106

lmakarov avatar Sep 21 '21 22:09 lmakarov

👍 need :D

arnisoph avatar Sep 30 '21 12:09 arnisoph

Any progress or news on this by any chance?

jotacamou avatar Dec 01 '21 22:12 jotacamou

Any word on this?

thebeardedpapi avatar Jan 10 '22 21:01 thebeardedpapi

Hello guys, do you have a workaround to be able to headers like Content-Security-Policy ? It's really annoying

griseau avatar Apr 01 '22 17:04 griseau

This definitely would be great to have +1

skymeyer avatar Apr 05 '22 20:04 skymeyer

Need this to add custom headers in response.

oryades avatar Apr 27 '22 12:04 oryades

Any updates on this? The level of engagement and support here is very frustrating. As previously stated the link is private so how can we even start it!? https://issuetracker.google.com/issues/191700241

This is a basic feature. I want to use GKE native ingresses to take advantage of the global GCE load balancing features but it still does not support custom response headers.

red8888 avatar Apr 28 '22 17:04 red8888

An progress? This is the only feature that is lacking for us to migrate to ingress-gce.

allenvino1 avatar Jun 16 '22 01:06 allenvino1

+1

dorfire avatar Jun 21 '22 09:06 dorfire

+1

bschaeffer avatar Jul 21 '22 20:07 bschaeffer

+1. Any progress on that?

anhnt094 avatar Jul 30 '22 10:07 anhnt094

+1

erikhubers avatar Jul 30 '22 12:07 erikhubers

we all need it)

itpromorus avatar Aug 03 '22 09:08 itpromorus

+1 we also need this feature ;)

baptiste-dauphin avatar Aug 11 '22 14:08 baptiste-dauphin

Any updates?

allenvino1 avatar Aug 19 '22 02:08 allenvino1

+1

bernardopericacho avatar Sep 29 '22 03:09 bernardopericacho

It took me about one hour of trying to get this done until I finally reached this issue...

It's such a common requirement to be able to set headers such as Cross-Origin-Opener-Policy, Cross-Origin-Resource-Policy, Cross-Origin-Embedder-Policy, Content-Security-Policy and others in one central location.

When using NGINX as Ingress we can simple set nginx.ingress.kubernetes.io/configuration-snippet.more_set_headers.

So there is really no way to do this with the gce ingress class? We have to fall back to using the Web-UI or gcloud CLI to set response headers on all of our backends (that were created by helm from a BackendConfig)?

A big +1 on this issue from me as well...

Agh42 avatar Oct 07 '22 14:10 Agh42

Custom response headers can now be configured using the BackendConfig CRD. This feature is available in new GKE 1.25+ clusters.

dup #1106

swetharepakula avatar Dec 27 '22 19:12 swetharepakula

Custom response headers can now be configured using the BackendConfig CRD. This feature is available in new GKE 1.25+ clusters.

dup #1106

Great news! Could you please share a link to documentation or source code explaining how to use it? I checked https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-configuration but it does not seem to mention this.

acondrat avatar Jan 04 '23 11:01 acondrat

I've just updated my cluster to 1.25.4-gke.2100, and as far as I can tell this feature is not yet available (kubectl describe crd backendconfigs.cloud.google.com)

MishaVeldhoen avatar Jan 25 '23 23:01 MishaVeldhoen

I gave an update in https://github.com/kubernetes/ingress-gce/issues/1106#issuecomment-1405593221. The initial rollout only was for newly created clusters that were at least 1.25. We have since rolled out the upgrade for existing 1.25 clusters. The upgrade will occur during your set maintenance windows.

swetharepakula avatar Feb 15 '23 00:02 swetharepakula

I gave an update in #1106 (comment). The initial rollout only was for newly created clusters that were at least 1.25. We have since rolled out the upgrade for existing 1.25 clusters. The upgrade will occur during your set maintenance windows.

~This doesn't seem to work if CDN is enabled? eg~

apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
  name: my-backend-config
spec:
  cdn:
    enabled: true
    cacheMode: "USE_ORIGIN_HEADERS"
    cachePolicy:
      includeHost: true
      includeProtocol: true
      includeQueryString: true
  # Don't seem to work with CDN
  customResponseHeaders:
    headers:
      - "Strict-Transport-Security: max-age=63072000; includeSubDomains; preload"
      - "X-Frame-Options: SAMEORIGIN"
      - "X-Content-Type-Options: nosniff"
      - "Content-Security-Policy: ..."
      - "Referrer-Policy: no-referrer-when-downgrade"
      - "X-XSS-Protection: 1; mode=block"
      - "Via: Unicorn Fartz"

EDIT: actually it looks like it just takes some time? Will report back in a little while.

EDIT2: it seemed to take a few more minutes than I expected but the above works.

skyl avatar Apr 02 '23 20:04 skyl