How to configure cookiepath for website with front-end and back-end on different ports?

三世轮回 提交于 2019-12-13 04:27:00

问题


For me, this is a rather complex problem and I'm currently stabbing the beast with your help, which I already received here: SessionID is not communicated between Client/Server in webpack4 project with php/apache backend and here How to configure session.save_path inside php.ini for webpack4 based website?

to sum up the imho essentials: I'm running my website front-end from the zurb foundation webserver, which integrates webpack4, babel7 and gulp (taskrunner). My backend is run by a no-install XAMPP apache/php server.

The backend works, docroot has been set accordingly and I've also created a Session folder inside the project (src/assets/Session). Session files are created and data is being written to it. However I cant access the session data because the PHPSESSID seems not to be stored/sent by the client. The response header of my POST jqueryAJAX contains the respective PHPSESSID, but the request Header doesn't contain any PHPSESSID at all. This way, my server spawns new sessions instead of accessing the existing one.

I've already tried numerous configurations for the php headers (see my posts above) and also undid all restrictions on cookies (but not trackers) in my portable firefox which I use to access my website. I'm not sure if this is due to the fact that my front-end (8000) runs on a different port than my backend (8099). And even if so, I don't really know how to put both on the same port. I already tried to but then either the site crashes or the front-end switches from port 8000 to 8001 automtically. Run Webpack based Website and XAMPP apache/php on same port

Now I try to fiddle around with the cookie settings in my php.ini. For example, since the docroot of my php files is NOT the root of my src folder, could it be that I have to configure the cookie path differently? It defaults to "/" which would be "the root folder" but since I have my php inside xampp folder and the docroot set to apache is the src/assets/php, could it be that the cookies are not accessible due to the root not being on top of my website project? Or do I even have to set the cookie path to the dist folder?

来源:https://stackoverflow.com/questions/57670157/how-to-configure-cookiepath-for-website-with-front-end-and-back-end-on-different

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!