2018-11-20 10:42
浏览 163

动态iframe丢失PHPSESSID cookie

I have a site which is run behind a node proxy. One part of the site loads data using <Query> of the react-apollo library. For some reason, whenever I refresh the page, the PHPSESSID cookie is not maintained and is changed everytime. But if I put the RightPanel component outside of a <Query> tag, session is maintained.

Please help

<Query query={GQL_CURRENT_USER}>
                    {({ loading, error, data }) => {
                        if (loading) return <div>Chargement...</div>;
                        if (error) return <div>Erreur...</div>;

                        // user not exist or problem fetching
                        if (data.User === null) return <div>Error while loading user.</div>

                        return (
                            <div className="main-container">
                                <UserContext.Provider value={{
                                    currentUser: data.User,
                                    <RightPanel />

Inside RightPanel load dynamically an iframe

    return (
        <main className={classes.root}>
            <div className={classes.container}>
                    <Route exact path="/">
                        <Redirect to="/user/suivi" />
                    <Route render={() => {
                        const hash = window.location.hash.substr(2).split("/");
                        return <LegacyView path={hash}></LegacyView>

LegacyView render

render() {
        return <iframe ref={this.iframe} onLoad={() => this.frameLoaded()} styleName="LegacyView" src={`${LegacyView.BASE_URL}${this.state.url}`} />
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

相关推荐 更多相似问题