-
Notifications
You must be signed in to change notification settings - Fork 610
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
[4.x]: 404 status when previewing unpublished entries #15016
Comments
@slemont3 is it a Cratt-styled 404 response or an nginx/apache styled 404? Are you accessing the control panel through site.com/admin and the front-end of the site is site.com? Or is control panel access subdomain-based? i.e. cp.site.com and the front-end is site.com |
Hi @angrybrad , thanks for getting back at this! It's a Craft-styled 404 response. And the control panel is accessed normally without a subdomain, so for example site.com/admin and the preview url would be: https://site.com/testpage?x-craft-preview=xxx&craft-token=xxxxxxx Note that the tokenParam config is set to 'craft-token' as we have to use the 'token' query parameter for something else. |
In addition to the above, we are currently getting the info that our Craft CMS license is invalid since our license is still being used on the live web server we're migrating the website from. Could that affect/limit the preview functionality of unpublished pages? |
Struggling with the very same issue |
@Envaya Also on Google Cloud? |
Nah - licensing issues won’t affect site functionality. Any chance we could get some Craft control panel and SSH access to that box to poke around a bit? If so, could you send the details over to support@craftcms.com and reference this issue? |
Not sure if this is related, but I am currently also having an issue with previews: My previous projects used a simple entry query with the x-craft-token set. Now, I need to set "drafts: null" in order to get data for the drafts; e.g.
Is it possible something did break/change from previous version of 4 to 4.9.5? |
@MilanDeruelle Just tested on 4.9.5 and it worked fine. I have a preview target set to the URL format <html>
<head>
<title>GraphQL Test</title>
</head>
<body>
{% set entryId = craft.app.request.getQueryParam('entryId') %}
{% set token = craft.app.request.getQueryParam('token') %}
<script type="module" async>
const entryId = {{ entryId|json_encode|raw }};
const token = {{ token|json_encode|raw }};
const response = await fetch('/api', {
method: 'POST',
headers: {
'Content-Type': 'application/graphql',
'X-Craft-Token': token,
},
body: `query {
entry(id: ${entryId}) {
title
}
}`
});
const json = await response.json();
document.write(`<p>${json.data.entry.title}</p>`);
</script>
</body>
</html> This is using the public schema, which I’ve configured to include all entry queries, but not drafts, revisions, or non-live elements. |
What happened?
Description
We are currently migrating an existing Craft website to a Google Cloud App Instance Flex and we are facing an issue with previewing new and unpublished entries. Neither the live editor preview nor the general preview for unpublished pages work and both document requests return a 404 HTTP status.
Steps to reproduce
Expected behavior
The entry's content is loaded and shown in either the live preview or in the regular view in a separate browser tab.
Actual behavior
The page cannot be found and we get a 404 error.
Additionl info
This behaviour only happens on the Google Cloud production or test environment. Locally, it works as expected. Therefore we assumed that there is an issue with the PRIMARY_SITE_URL env variable. Locally, it is set to http://127.0.0.1:8081. On the production and test environments, it is set to the corresponding .appspot.com domain generated by the Google Cloud App engine instance, via which the website is currently reachable. Once the migrated sound will be live with a custom domain, the .appspot.com domain will be replaced by the actual custom domain.
Additionally, we verified whether the preview token is properly saved in the database once it is created, which is the case.
Any help would be highly appreciated!
Craft CMS version
Craft Pro 4.8.9
PHP version
8.3.6
Operating system and version
Linux 6.1.75+
Database type and version
MySQL 8.0.31
Image driver and version
GD 8.3.6
Installed plugins and versions
The text was updated successfully, but these errors were encountered: