Front end developers must read! Starting from scratch, teach you to build a low code website platform in stages>>>
When using res. redirect(), there are always errors as shown in the title
The reason is that after redirect(), the node does not stop executing, but continues to execute the following code. The page has jumped and the request response has ended. If the subsequent code still processes req, res will have a problem
So when you use res. redirect(), you must add return, that is, return res. redirect (‘/ dir’)
Of course, if the statement is the last line, return is not required
Similar Posts:
- Strange frame error caused by incorrect use of flash. Redirect (‘/ path’) in flash
- [Solved] Cannot call sendRedirect() after the response has been committed
- Using fastcgi_ finish_ Request to achieve asynchronous processing and improve the response speed of the page
- How to Solve Python Error: “HTTP Error 403: Forbidden”
- Proxy error :couldnot proxy request [How to Solve]
- The use of try… Catch in MATLAB
- [Solved] Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
- Request failed with status code 500 & Self referencing loop detected for property ‘xx‘ with type
- joi Validation error: UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
- How to deal with the problem of failed to execute ‘send’ on ‘XMLHttpRequest’: failed to load ‘URL’