Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
netlify-plugin-redirect-with-auth
Advanced tools
Add redirects with authorization header set in env variable
This Netlify build plugin allows you to add redirects with authentication headers to your Netlify site.
netlify.toml
filenpm install netlify-plugin-redirect-with-auth
netlify.toml
file:[[plugins]]
package = "netlify-plugin-redirect-with-auth"
[plugins.inputs]
redirects = [
{ from = "/submit", to = "https://api.example.com/submit" },
{ from = "/api/*", to = "https://api.example.com/:splat" }
]
Set the NETLIFY_REDIRECT_AUTH_HEADER
environment variable:
For production:
NETLIFY_REDIRECT_AUTH_HEADER
Bearer your-token-here
)For development:
.env
file in your project root (if it doesn't exist already).env
file:
NETLIFY_REDIRECT_AUTH_HEADER=Bearer your-token-here
netlify dev
Note: Make sure to add .env
to your .gitignore
file to avoid committing sensitive information to your repository.
Set the following environment variable in your Netlify site settings:
NETLIFY_REDIRECT_AUTH_HEADER
: The authentication header to be added to the redirects.Configure the plugin in your netlify.toml
file:
[[plugins]]
package = "netlify-plugin-redirect-with-auth"
[plugins.inputs]
redirects = [
{ from = "/submit", to = "https://api.example.com/submit" },
{ from = "/api/*", to = "https://api.example.com/:splat" }
]
Each redirect object in the redirects
array must have both from
and to
properties.
onPreBuild
and onPreDev
events.NETLIFY_REDIRECT_AUTH_HEADER
environment variable.redirects
input to ensure it's a non-empty array of valid redirect objects.from
and to
URLsforce
flag set to trueIf you encounter issues:
NETLIFY_REDIRECT_AUTH_HEADER
environment variable is set correctly.redirects
input in netlify.toml
is formatted correctly.from
and to
properties.For more help, please open an issue in the plugin's GitHub repository.
FAQs
Add redirects with authorization header set in env variable
The npm package netlify-plugin-redirect-with-auth receives a total of 3 weekly downloads. As such, netlify-plugin-redirect-with-auth popularity was classified as not popular.
We found that netlify-plugin-redirect-with-auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.