# Using nginx ingress annotations to change host header for backend service

**URL:** <https://discuss.kubernetes.io/t/using-nginx-ingress-annotations-to-change-host-header-for-backend-service/7810>\
**Category:** General Discussions\
**Created:** [September 6, 2019, 4:43am UTC](https://discuss.kubernetes.io/t/using-nginx-ingress-annotations-to-change-host-header-for-backend-service/7810 "2019-09-06T04:43:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwcoop17](https://avatars.discourse-cdn.com/v4/letter/m/ac8455/32.png) [@mwcoop17](https://discuss.kubernetes.io/u/mwcoop17)\
**Post date:** [September 6, 2019, 4:43am UTC](https://discuss.kubernetes.io/t/using-nginx-ingress-annotations-to-change-host-header-for-backend-service/7810/1 "2019-09-06T04:43:07Z")

</div>

Hello,

I’m running Gitlab on Google Kubernetes Engine. Gitlab Pages serves static websites for URLs like [my-project.example.io](http://my-project.example.io). I am trying to add nginx ingress rules to proxy something like [my-project.com](http://my-project.com) to Gitlab Pages as though the user requested [my-project.example.com](http://my-project.example.com).

I have tried setting the [nginx.ingress.kubernetes.io/upstream-vhost](http://nginx.ingress.kubernetes.io/upstream-vhost) annotation to the desired pages URL, but it appears to still receive a request for [my-project.com](http://my-project.com) (which it does not understand). Does anyone have ideas on how to better accomplish this goal? My primary desire is to proxy to the internal service IP rather than the external IP for \*.example.io.

P.S. Apologies for any bad formatting. I am completely blind, so sometimes that gets difficult. 🙂

---

<div class="post-metadata">

**Author:** ![mwcoop17](https://avatars.discourse-cdn.com/v4/letter/m/ac8455/32.png) [@mwcoop17](https://discuss.kubernetes.io/u/mwcoop17)\
**Post date:** [September 6, 2019, 4:44am UTC](https://discuss.kubernetes.io/t/using-nginx-ingress-annotations-to-change-host-header-for-backend-service/7810/2 "2019-09-06T04:44:12Z")

</div>

Oh. In addition, I have seen notes about Ruby using the X-Forwarded-Host header instead of Host. Does anyone know how I might overwrite this in the ingress?

---

<div class="post-metadata">

**Author:** ![georgecrawford](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/georgecrawford/32/6338_2.png) [@georgecrawford](https://discuss.kubernetes.io/u/georgecrawford)\
**Post date:** [November 29, 2020, 9:23pm UTC](https://discuss.kubernetes.io/t/using-nginx-ingress-annotations-to-change-host-header-for-backend-service/7810/3 "2020-11-29T21:23:12Z")

</div>

Hey @mwcoop17. Did you ever find an answer to this? I have exactly the same problem (also for GitLab pages!). Thanks
