-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding redirects through netlifyConfig.redirects
in build plugin is not applying redirects to the build
#4838
Comments
There is much more information in the helpdesk ticket about this specific situation that Netlify staff may need while working on this case. This link will only work for Netlify employees. |
We'd love to get an answer early next week, since this seems like either a bug on our side, or a "he's holding it slightly wrong", and in that case one of the authors of the build script can likely just say "oh do x not y". If there is more debugging needed than this, please let us know :) |
Following through the reproduction steps, I modified the redirect rule to the one below netlifyConfig.redirects.push({
from: "/",
to: "https://petsofnetlify.com",
status: 200,
force: true,
}) The deploy summary shows the the redirect was processed And visiting https://incredible-granita-3f657d.netlify.app proxies https://petsofnetlify.com. Although static assets fail to load. So it seems like the build plugin applies redirects to the build correctly |
I'd like to figure out what the difference is here, if you don't mind. My app build doesn't show any redirect rules processed in the deploy summary. Does your app have a netlify.toml file? My app had one, but no redirects. My app also had no |
Yeah it has a netlify.toml, https://github.com/jobala/tmp-repo, it lacks |
@passion4code have you had any success in getting this to work? |
Not yet. I will need a few days before I am able to look into this again. |
Describe the bug
I created a local plugin which attempts to update the
netlifyConfig.redirects
array.The plugin itself is rather simple. I renamed some values below, but the logic remains
manifest.yaml:
Plugin's index.js file
When the plugin runs, I can confirm that the build process is attempting to update that array in the log output, such as the log output generated from Netlify for modifying the property.
10:04:23 AM: Netlify configuration property "redirects" value changed to [ 10:04:23 AM: { 10:04:23 AM: from: '/de-de/*', 10:04:23 AM: to: 'https://cool-netlify-app-here-eu.netlify.app/de-de/:splat', 10:04:23 AM: status: 200, 10:04:23 AM: force: true 10:04:23 AM: }, ...
However, once the build completes, there are no redirect rules actually applied, as indicated by the build information at the top of the build details view (as well as just testing out the endpoints on the hosted build).
Steps to reproduce
Create a fresh netlify site with the plugin code that I mentioned in the bug description, as well as activating the plugin in your site's
netlify.toml
fileConfiguration
Deploy logs
Relevant log snippet (actual site name replaced with a fake site name)
The text was updated successfully, but these errors were encountered: