Trying to proxy, but get a redirect

Hi there!

I’m trying to set up a proxy from our new Netlify website to our old website for a few pages that are not yet ported. However, despite using a 200 in the _redirects file, the URL in the browser changes - Netlify redirects instead of proxying.

Rewrite rule in question is here:

/pipeline_schema_builder/* 200!

What I want is to go to and the browser URL remain as such (with a 200 response). Instead, it redirects to , replacing the URL.

What am I missing here? As far as I can tell it should be the same setup as described in the docs?



Your destination is serving a 301:

curl -I ""
HTTP/2 301

This is working as intended.

Not really - the redirection is working, but I want a rewrite / proxy.

From the docs:

When you assign an HTTP status code of 200 to a redirect rule, it becomes a rewrite . This means that the URL in the visitor’s address bar remains the same, while Netlify’s servers fetch the new location behind the scenes.

This can be useful for […] transitioning for legacy content.

Now all requests to /api/... will be proxied through to straight from our CDN servers without an additional connection from the browser.

So what I would like to see is this (hand-typed example):

curl -I ""
HTTP/2 200

In other words, I don’t want to see anywhere in the response.

However, currently it is redirecting with a 301 (the default behaviour for netlify redirection if no code is specified).

Your destination server is sending a 301. Netlify is passing it along. Stop sending a 301 from your destination server if you don’t want a 301.

Argh you are of course completely correct :man_facepalming: :see_no_evil:

I was sure that this wasn’t the case because running curl on the oldsite gave a 200:

❯ curl -I
HTTP/2 200
content-type: text/html; charset=UTF-8
date: Sun, 16 Jul 2023 18:05:22 GMT
server: Apache

However, that wasn’t the URL that Netlify was trying to fetch - there was a trailing slash, and I had a long-forgotten .htaccess redirection rule set up to remove trailing slashes :see_no_evil:

❯ curl -I
HTTP/2 301
content-type: text/html; charset=iso-8859-1
date: Sun, 16 Jul 2023 18:03:02 GMT
server: Apache

I removed the R=301 from that and now, sure enough, I get a 200 response from Netlify:

❯ curl -I ""
HTTP/2 200
age: 1
content-type: text/html; charset=UTF-8
date: Sun, 16 Jul 2023 18:05:31 GMT
server: Netlify
strict-transport-security: max-age=31536000
x-nf-request-id: 01H5FY22E4FEGSK8EXNYVWKWCC

Notably, the browser does still switch out the address bar to when I visit - but in my current use case all I need is the 200 code so this isn’t a problem.

Many thanks for your help @hrishikesh and apologies that it took me a while to get there… :bowing_man: