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]]
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
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.
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).
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.
Yes, I am
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?
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.