Skip to content

fix: redirect没有清除,导致request不同步,引用错误的header - #396

Open
blankqwq wants to merge 1 commit into
hhxsv5:PHP-7.xfrom
blankqwq:master
Open

fix: redirect没有清除,导致request不同步,引用错误的header#396
blankqwq wants to merge 1 commit into
hhxsv5:PHP-7.xfrom
blankqwq:master

Conversation

@blankqwq

Copy link
Copy Markdown
Contributor

在容器中清除 #370

@hhxsv5

hhxsv5 commented Jan 17, 2022

Copy link
Copy Markdown
Owner

给个例子?

@blankqwq

Copy link
Copy Markdown
Contributor Author

我将worker_num设置为1,在某请求中设置了header referer,后面所有的用户基本都读取了此用户的

Route::any('/', function () {
    return Redirect::getUrlGenerator()->getRequest()->headers->get('referer');
});

Route::get('/test',function (){
   return Redirect::back();
});

当某个请求带了referer,之后其他用户也会使用第一个用户的referer,访问test的时候就会跳转到该referer

class Redirector
{

    /**
     * Create a new Redirector instance.
     *
     * @param  \Illuminate\Routing\UrlGenerator  $generator
     * @return void
     */
    public function __construct(UrlGenerator $generator)
    {
        $this->generator = $generator;
    }

 /**
     * Create a new redirect response to the previous location.
     *
     * @param  int  $status
     * @param  array  $headers
     * @param  mixed  $fallback
     * @return \Illuminate\Http\RedirectResponse
     */
    public function back($status = 302, $headers = [], $fallback = false)
    {
        return $this->createRedirect($this->generator->previous($fallback), $status, $headers);
    }

...

@uptonyuan

uptonyuan commented May 20, 2024 via email

Copy link
Copy Markdown

@mnizfd

mnizfd commented May 20, 2024 via email

Copy link
Copy Markdown

@xwiz

xwiz commented Aug 7, 2024

Copy link
Copy Markdown

@hhxsv5 Please merge

@mnizfd

mnizfd commented Aug 7, 2024 via email

Copy link
Copy Markdown

@uptonyuan

uptonyuan commented Aug 7, 2024 via email

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants