Skip to content
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

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

Open
wants to merge 1 commit into
base: PHP-7.x
Choose a base branch
from

Conversation

blankqwq
Copy link
Contributor

在容器中清除 #370

@hhxsv5
Copy link
Owner

hhxsv5 commented Jan 17, 2022

给个例子?

@blankqwq
Copy link
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
Copy link

uptonyuan commented May 20, 2024 via email

@mnizfd
Copy link

mnizfd commented May 20, 2024 via email

@xwiz
Copy link

xwiz commented Aug 7, 2024

@hhxsv5 Please merge

@mnizfd
Copy link

mnizfd commented Aug 7, 2024 via email

@uptonyuan
Copy link

uptonyuan commented Aug 7, 2024 via email

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