Proxy redirect dosen't work

Hi, I have some issues while trying to add proxy redirects to my site.
What I am trying to do is to redirect from the main page of my site, which is a GatsbyJs site and lays in Netlify, to a page in a different server while keeping the first site domain in the url.

What I have done so far:
Added a ‘netlify.toml’ file to the Gatsby root folder.
This is the content of the toml file:

[[redirects]]
  /  http://example.com/new-homepage/  200

At the moment nothing happened
The site I want to arrive to is a simple Wordpress site.
What am I doing wrong?

This is my app name:
https://dreamy-einstein-27e164.netlify.app

Hi @dav

The above is the format for a _redirects file

/    https://example.com    200

A netlify.toml should look like this

[[redirects]]
  from = "/"
  to = "https://example.com"
  status = 302 
  # 302 temporary redirect;
  # 301 permanent;
  # 200 to return data without changing URL in address bar
  force = true  # will redirect even if a page exists

See redirects and rewrite docs.

Thank you for your fat response!!
Tried that as well

[[redirects]]
  from = “/”
  to = "http://example.com/new-homepage/"
  status = 200
  force = true

and nothing happend

A 200 will not redirect.

OK. Redirects with this status code will change the server response without changing the URL in the browser address bar. This is used for rewrites and proxying.

If you want to redirect, you need to use a 301 or 302.

That I exactly what I want, to display the first site url " https://dreamy-einstein-27e164.netlify.app/ "but show this page
http://example.com/new-homepage/

Is the page you want to show on the same Netlify site? Is it a different Netlify site? Is it site not on Netlify?

the new page is not in Netlify

This is possibly considered an open proxy (see Recent change: open proxy deprecation) and as per Terms of Use Agreement

  1. The Services may not be used as an open proxy or in any manner resembling an open proxy.

This is probably why it won’t work.

Hi @dav,

This should work fine. However, I’m not seeing any 200 status code based redirect applied on your website. I can see about 145 redirects, but all are 301 (except 1 which is 302).

How do I add a 200 status code based redirect?

I tried what is written in the link you sent me, this is how my netlify.toml file looks right now.

[[redirects]]
  /proxy/ http://example.com/  200

I read this url

and in the first paragraph this is written:

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 is exactley what I want to achieve…

By adding it the way you’ve shown above, but I don’t see it applied for your website. Are we still taking about dreamy-einstein-27e164?

Yes, I am :slight_smile:
I add it to the gatsby files and then i deploy the files using git via gatsby cloud. is it possible that the .toml file is not uploaded with the build? should I upload it manually?

Just to be sure, could you specify a permalink to the deploy in which you’re sure you’ve added these rewrites?

this is how my toml file lokks

[[redirects]]
  /proxy/ http://staging-catonewwebsite.kinsta.cloud/new-homepage/  200

That is not the correct format for a netlify.toml as I mentioned previously.
Furthermore http://staging-catonewwebsite.kinsta.cloud/new-homepage/ is not accessible.

I have tried the format bellow wut it didn’t work eather.

than I tried as it is mentioned in the link you sent me:

I am a bit confused:

  1. what is the correct way to show the user a page from another site (no nelify) but still keep him in the current domain?

This method is correct, but it would help if you could share a link to a deploy in which you say this is not working.

what do you mean when you say link to a deploy?

The link from Preview button here: