TYPO3-Headless / headless

TYPO3 Headless JSON API providing content for PWA application (e.g. javaScript apps like nuxt-typo3)
https://t3headless.io
GNU General Public License v2.0
159 stars 60 forks source link

Unclear Documentation regarding Preview of Hidden Pages #684

Open apus-0 opened 10 months ago

apus-0 commented 10 months ago

Following sentence can be found in the documentation: "If your frontend application passes all cookies from backend correctly you should be able to preview content associated with the root domain."

In my case the backend user cookie is available in the frontend, but i got an 404. This makes sense cause i don't know how to pass the cookie information back to TYPO3 to get the data of the hidden page. I mean the fronted has to send the cookie data to the backend when fetching data? Or am I wrong?

twoldanski commented 10 months ago

Hi @apus-0, what domain setup do you have? You have something like api.your-site.tld (TYPO3) and your-site.tld (FE) or something different?

apus-0 commented 10 months ago

first I triedapi.your-site.tld (TYPO3) and frontend.your-site.tld (FE) and after your response I also tried api.your-site.tld (TYPO3) and your-site.tld (FE). both appoached didn't work for me. in both cases cookie was set in frontend by TYPO3 when previewing the page, but the in the end i got a 404 page

twoldanski commented 10 months ago

if your main domain is matching and you have setup TYPO3 is api.your-site.tld and fe app is your-site.tld just setup backend cookie (which allows you see hidden pages) to domain .your-site.tld and it should work :)

lukaszuznanski commented 9 months ago

@apus-0 could you send some screenshots of your cookie setup? This would help I believe. We have tested this in several projects, so we can provide some assistance for you.

apus-0 commented 9 months ago

Thanks a lot for your replies and for your help.

I set up the cookie domain in the ext_localconf.php of my sitepackage to $GLOBALS['TYPO3_CONF_VARS']['BE']['cookieDomain'] = getenv('HKC_COOKIE_DOMAIN');

which is HKC_COOKIE_DOMAIN=.hkc-de.local

and when opening the backend, following cookie is set:

image

and by opening the fronted app, following cookie is set:

image

What came into my mind is that i am currently running the site on my local machine, in a docker environment and the domains are no "real" domains. they are only network aliases of docker. Maybe this causes the disfunctionality? At the moment i dont have a test system with "real" domains. But I am working on it. Maybe this solves the problem?

Please let me know, if i should provide further information regarding the set up.

Tank you in advance.