# Having an issue with a Netlify proxy

**URL:** <https://answers.netlify.com/t/having-an-issue-with-a-netlify-proxy/109302>\
**Category:** Support\
**Tags:** proxying\
**Created:** [December 27, 2023, 5:57am UTC](https://answers.netlify.com/t/having-an-issue-with-a-netlify-proxy/109302 "2023-12-27T05:57:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Goodman](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/john_goodman/32/51346_2.png) [@John\_Goodman](https://answers.netlify.com/u/John_Goodman)\
**Post date:** [December 27, 2023, 5:57am UTC](https://answers.netlify.com/t/having-an-issue-with-a-netlify-proxy/109302/1 "2023-12-27T05:57:18Z")

</div>

Hey, I’m having an issue with a proxy on Netlify. I’ve read all the docs and the troubleshooting post in this community ( [[Support Guide] Making redirects work for you - troubleshooting and debugging](https://answers.netlify.com/t/support-guide-making-redirects-work-for-you-troubleshooting-and-debugging/13433) ), but I still seem to be having an issue.

Instead of showing the proxy’d url as part of my site, it’s just sending me to the proxy’d url. Here are the details:

I have a react app hosted on Netlify that has the `https://gyfteo.com/` domain setup ( `loving-payne-8c0665` is the Netlify name ). I want to proxy a wordpress blog ( `https://blog.gyfteo.com/` ) to `https://gyfteo.com/blog`. The proxy seems to partially work, except when I go to `https://gyfteo.com/blog`, it’s just sending me to `https://blog.gyfteo.com/` instead of showing the blog on `https://gyfteo.com/blog`.

I’m using a netlify.toml file and it is being processed when the react site is deployed to netlify. Here’s the file:

```auto
[[redirects]]
  from = "/blog/*"
  to = "https://blog.gyfteo.com/:splat"
  status = 200
  headers = {X-From = "Netlify"}

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

```

I had `force = true` in there but removed it in hopes that would do the trick, but no luck. Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [December 31, 2023, 4:26pm UTC](https://answers.netlify.com/t/having-an-issue-with-a-netlify-proxy/109302/2 "2023-12-31T16:26:56Z")

</div>

It’s your server that’s sending a 302:

 ![image](https://global.discourse-cdn.com/netlify/original/3X/7/6/76f7ba59a0b24e5b03fc8b2e2ea6648b2deaefbd.png)

Thus the issue.

---

<div class="post-metadata">

**Author:** ![John\_Goodman](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/john_goodman/32/51346_2.png) [@John\_Goodman](https://answers.netlify.com/u/John_Goodman)\
**Post date:** [December 31, 2023, 5:57pm UTC](https://answers.netlify.com/t/having-an-issue-with-a-netlify-proxy/109302/3 "2023-12-31T17:57:17Z")

</div>

Hey @hrishikesh, thanks for the reply. The server is Netlify - any suggestions on what I can update in the netlify.toml file? Or is there another route to look into here?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [December 31, 2023, 6:05pm UTC](https://answers.netlify.com/t/having-an-issue-with-a-netlify-proxy/109302/4 "2023-12-31T18:05:08Z")

</div>

> [@John\_Goodman](#):
>
> The server is Netlify

`x-redirect-by` and `x-turbo-charged-by` show the source of the issue. The `server` is Netlify because you proxied the request. But the source of the redirect is not Netlify, it’s WordPress.

---

<div class="post-metadata">

**Author:** ![John\_Goodman](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/john_goodman/32/51346_2.png) [@John\_Goodman](https://answers.netlify.com/u/John_Goodman)\
**Post date:** [December 31, 2023, 8:00pm UTC](https://answers.netlify.com/t/having-an-issue-with-a-netlify-proxy/109302/5 "2023-12-31T20:00:21Z")

</div>

Hey @hrishikesh, right, ya, i’m trying to proxy a wordpress site to [Coming Soon – Gyfteo Blog](http://gyfteo.com/blog). I’m not following your responses on what the issue is. My understanding of setting up a proxy is that i can make another site show up as a subdirectory of my main domain. Do you know if there is anything I need to change in my netlify.toml file to make this work?

---

<div class="post-metadata">

**Author:** ![fool](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/fool/32/37_2.png) [@fool](https://answers.netlify.com/u/fool)\
**Post date:** [January 1, 2024, 8:39pm UTC](https://answers.netlify.com/t/having-an-issue-with-a-netlify-proxy/109302/6 "2024-01-01T20:39:21Z")

</div>

If you intend to proxy to us, we won’t be able to help you as described here:

> [@\[Support Guide\] Why not proxy to Netlify?](https://answers.netlify.com/t/support-guide-why-not-proxy-to-netlify/8869):
>
> Last reviewed by Netlify Support Staff in August 2023 Netlify runs a CDN backed by several separate network service providers, and our CDN [automatically routes your web visitors’ traffic to a network-nearby server](https://answers.netlify.com/t/support-guide-how-are-requests-routed-to-the-nearest-netlify-cdn-node/105) to give them the fastest possible response time…as long as you let their browsers talk directly to our CDN! We know you want your [your web traffic to be fast](https://www.netlify.com/tags/performance/); your [deploys and rollbacks to be atomic](https://docs.netlify.com/site-deploys/overview/); and your [Analytics data](https://www.netlify.com/products/analytics/) to be useful. If you proxy to Netlify, you’ll have problems…

If you’d like us to proxy to another site, let us know and we can guide you in that configuration.

---

<div class="post-metadata">

**Author:** ![John\_Goodman](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/john_goodman/32/51346_2.png) [@John\_Goodman](https://answers.netlify.com/u/John_Goodman)\
**Post date:** [January 3, 2024, 12:42am UTC](https://answers.netlify.com/t/having-an-issue-with-a-netlify-proxy/109302/7 "2024-01-03T00:42:58Z")

</div>

hey @fool, I think i’m saying it right when i say, yes, i want to proxy to another site. My main site is hosted on Netlify and I want to proxy another site to a sub-directory of my main domain. What is the correct configuration to do this?

Thanks for your time.

---

<div class="post-metadata">

**Author:** ![luke](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/luke/32/39_2.png) [@luke](https://answers.netlify.com/u/luke)\
**Post date:** [January 3, 2024, 2:29am UTC](https://answers.netlify.com/t/having-an-issue-with-a-netlify-proxy/109302/8 "2024-01-03T02:29:29Z")

</div>

Hi, @John_Goodman. The issue is that a proxy just returns the responses from the site you proxy to. The site you proxy to is sending the 302 and we just pass that 302 response along to the client. If you want to fix this, you need to change the behavior of the proxy target.

Here are some examples to clarify. Here is a HTTP response showing the status code returned and the location header (if there is one):

```txt
$ curl --compressed -svo /dev/null --stderr - https://www.gyfteo.com/blog/ | egrep '^< (HTTP|location)'
< HTTP/2 302
< location: https://blog.gyfteo.com/coming-soon/

```

To understand where the 302 originates, let’s look at the redirect rule again:

```txt
[[redirects]]
  from = "/blog/*"
  to = "https://blog.gyfteo.com/:splat"
  status = 200
  headers = {X-From = "Netlify"}

```

The rule above will take a request to this URL below:

- `https://www.gyfteo.com/blog/`

and proxy it to this URL:

- `https://blog.gyfteo.com/`

Whatever that URL above sends as a response, that is what the HTTP client will receive.

So, let’s test that URL using the same `curl` example as before so see what response it sends:

```txt
$ curl --compressed -svo /dev/null --stderr - 'https://blog.gyfteo.com/' | egrep '^< (HTTP|location)'
< HTTP/2 302
< location: https://blog.gyfteo.com/coming-soon/

```

This is the same 302 coming directly from the proxy target.

This is why you get the 302 at Netlify. The 302 is coming from the proxy target itself. All Netlify does (all any proxy does) is just pass along the response of the proxy target to the HTTP client. If you don’t want the 302 sent you need to change that behavior at the proxy target (at `blog.gyfteo.com`).

If there are other questions about this, please let us know.

---

<div class="post-metadata">

**Author:** ![John\_Goodman](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/john_goodman/32/51346_2.png) [@John\_Goodman](https://answers.netlify.com/u/John_Goodman)\
**Post date:** [January 3, 2024, 4:22am UTC](https://answers.netlify.com/t/having-an-issue-with-a-netlify-proxy/109302/9 "2024-01-03T04:22:13Z")

</div>

Ooooookkk, that explains it. I didn’t realize the site I was proxying had a redirect on. I turned it off and the proxy is working as expected. Thanks for your detailed explanation @luke
