Tried NYM-Mixnet privacy communication that no one can intercept
As of April 2022, almost all infrastructure and network engineers have probably never heard of NYM. On the other hand, some of you may have arrived at …
If you want to use axios to send the browser’s SessionCookie and other information directly to the server, set it as follows.
axios.get('url',
{
withCredentials: true
}
)
And the server side allows the following. (Use cors) This time, the example is for the case where the server side is NoneJS express, but it is the same for other languages and frameworks.
import * as express from "express";
const cors = require('cors')
const app = express()
app.use(cors({credentials: true, origin: true}));
This is the only way for Axios to communicate with the server using the browser’s session information. Note that you need to set credentials on the server side as well. By the way, HTTPOnly cookies are also sent in this way, so it is better to set HTTPOnly for security reasons. Please think carefully about the security of other API communication.(Check out this article)
There are times when you want to hit the WebAPI from the server side before responding to the browser.
And of course, there are times when you want to send a browser cookie to that communication as well. In this case, withCredentials cannot send browser cookies to the endpoint. (Naturally, since the communication is from the server side.)
In such a case, you can set the cookie as follows
// In Server-side
auth.get('/', function(req, res, next) {
axios.get('url',
headers: {
Cookie: req.headers.cookie
}
)
});
Just set the cookie in the Express request in the headers. Now, the cookie information shared to the server side can be shared to other backends. For example, assume that you have multiple backends, such as in a microservice design.
The security of HTTP communication is very important, so please refer to the following
(Article migrated from another blog)
As of April 2022, almost all infrastructure and network engineers have probably never heard of NYM. On the other hand, some of you may have arrived at …
Words like “web 3.0” have been popular since around 2020. There has also been a virtual currency boom for some time now, and the systems …