-
Notifications
You must be signed in to change notification settings - Fork 81
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
Set Cookies for Reverse Proxy Server with Nginx/Njs #13
Comments
Hi @Minomine61 , I don't understand your question very well, However, You can add/inject cookies in your requests through the Nginx Reverse Proxy, by implementing your code using Njs module
To implement this My Best Wishes. |
I am little bit confused with adding cookies method, actually i am new with JS. I have been working with python but now JS is new for me. |
converting this array to function addingCookiesMethod (r){
cookies = [];
jsonCookies.forEach(obj=>{
const name = obj.name;
const value = obj.value;
//and so on .. in a regular js code you can do this by one line
// const {name,value,domain,.....} = obj; // but I think its not supported yet in Njs module.
cookies.push(`${name}=${value}; ${httpOnly ? 'httpOnly' : ''}; ........`);
}
// for this Q: could you please ellaborate how should i need to write to inject
//do the next line
r.headersOut["Set-Cookie"] = cookies;
//do the remaining code/logic......
}
) |
I do want to pass explicit JSON cookies to Backend server with Nginx Javascript module.
but i am kind of confused. Please if you can help me with ASAP it can save me from getting fired from job
The text was updated successfully, but these errors were encountered: