无头wordpress graphQl端点导致XAMPP未找到404 URL

发布于 2025-01-23 19:03:16 字数 4176 浏览 5 评论 0原文

我正在尝试使用Xampp apache localhost服务器提供的GraphQL端点(从无头WordPress项目中进行自动化),但是当我使用WordPress中的GraphQL设置提出的建议时(https:// localhost/do-do-pizza/do-pizza/ GraphQl)我找回一个404 URL。

一些对于任何试图回答此问题的人都可能有用的细节:

  • 项目文件夹实际上是“ do-do-do-bizza”,因此自动化端点

“

  • 我的项目的WordPress侧效果很好,实际上是很好的,我能够通过提供的IDE

/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the installation.
 * You don't have to use the web site, you can copy this file to "wp-config.php"
 * and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * Database settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://wordpress.org/support/article/editing-wp-config-php/
 *
 * @package WordPress
 */

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'does_pizza' );

/** Database username */
define( 'DB_USER', 'root' );

/** Database password */
define( 'DB_PASSWORD', '' );

/** Database hostname */
define( 'DB_HOST', 'localhost' );

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8mb4' );

/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/**#@+
 * Authentication unique keys and salts.
 *
 * Change these to different unique phrases! You can generate these using
 * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
 *
 * You can change these at any point in time to invalidate all existing cookies.
 * This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define( 'AUTH_KEY',         '/fOC;iXzZpRnq[-,Qks$w!.rdjZO?m^A1|lI:k,}i$*.YzsJzpd)Q&S4)O0JpU^P' );
define( 'SECURE_AUTH_KEY',  '`0TnWd!<k+cCa9EIH7+P`g>BqZnyJ<NM8Z`;7u%sm%r4gQFS@%Qj53vi8n7P|):b' );
define( 'LOGGED_IN_KEY',    '05Y6C;<O%V5Ng<gP%W]vTnO2X;qc%;ncm8@,,0#Q#,UlmDl!{&yPzMa-cdh<2>I$' );
define( 'NONCE_KEY',        'Lf_NZQ,~-EI]!4KU4c682fy0xovx]r&jXG70J^-tRms(NQ=,7,rZYW8siDyVd,({' );
define( 'AUTH_SALT',        'aw!Cmo?uv>l 0Ph#{;T[)G9,XdzT+M~unG!M6A1R)}Jbu3QUC}&+~/taon{~U{9}' );
define( 'SECURE_AUTH_SALT', ')]#jI2IJZySp)b<Io~!xwY%ADUmXbbl^AH#gty({Bhjl4XsjJPw+1[?r/](6^Q8}' );
define( 'LOGGED_IN_SALT',   '}T:i=Y_9ET#(uWLLu$u?p1k{V1M7t$@0=XX}!>lIa>T.[E>$4$s6 EF#>F+L;O,S' );
define( 'NONCE_SALT',       'uf3S3C.]HaSPazeZgM^HNTLb<v63QFhT[t`W|`qZL$MdrY/$bOljiU^PaFb~=En:' );

/**#@-*/

/**
 * WordPress database table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the documentation.
 *
 * @link https://wordpress.org/support/article/debugging-in-wordpress/
 */
define( 'WP_DEBUG', false );

/* Add any custom values between this line and the "stop editing" line. */



/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
    define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php'; 
  • 在Postman中,我正在禁用SLL证书,只是因为我想看到请求成功,但我宁愿使用它

  • 我试图在端口443和80上拨打Localhost,但我得到了相同的结果< /p>

这是我第一次尝试这样做,因此,如果您需要任何额外的信息,请让我知道。

预先感谢您的任何帮助:)

I am trying to consume a GraphQL endpoint (autogenerated from a headless WordPress project) which is served over XAMPP Apache localhost server, but when I hit the endpoint with suggested from the GraphQL settings in WordPress (https://localhost/does-pizza/graphql) I get back a 404 URL not found.

Some details that could be useful to anybody trying to answer this question:

  • The project folder name is actually 'does-pizza', hence the autogenerated endpoint

enter image description here

  • The WordPress side of my project works just fine, in fact, I am able to send GraphQL queries through the provided Ide

enter image description here

  • The wp-config.php just in case you need it
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the installation.
 * You don't have to use the web site, you can copy this file to "wp-config.php"
 * and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * Database settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://wordpress.org/support/article/editing-wp-config-php/
 *
 * @package WordPress
 */

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'does_pizza' );

/** Database username */
define( 'DB_USER', 'root' );

/** Database password */
define( 'DB_PASSWORD', '' );

/** Database hostname */
define( 'DB_HOST', 'localhost' );

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8mb4' );

/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/**#@+
 * Authentication unique keys and salts.
 *
 * Change these to different unique phrases! You can generate these using
 * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
 *
 * You can change these at any point in time to invalidate all existing cookies.
 * This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define( 'AUTH_KEY',         '/fOC;iXzZpRnq[-,Qks$w!.rdjZO?m^A1|lI:k,}i$*.YzsJzpd)Q&S4)O0JpU^P' );
define( 'SECURE_AUTH_KEY',  '`0TnWd!<k+cCa9EIH7+P`g>BqZnyJ<NM8Z`;7u%sm%r4gQFS@%Qj53vi8n7P|):b' );
define( 'LOGGED_IN_KEY',    '05Y6C;<O%V5Ng<gP%W]vTnO2X;qc%;ncm8@,,0#Q#,UlmDl!{&yPzMa-cdh<2>I
  • The same request in Postman
    enter image description here

  • In Postman I am disabling the SLL certificate, just because I want to see the request succeed, but I'd of course rather use it

  • I have tried to call both localhost on port 443 and 80 but I get the same result

This is the first time I try to do something like this, so if you need any extra piece of information just let me know it.

Thanks in advance for any help :)

); define( 'NONCE_KEY', 'Lf_NZQ,~-EI]!4KU4c682fy0xovx]r&jXG70J^-tRms(NQ=,7,rZYW8siDyVd,({' ); define( 'AUTH_SALT', 'aw!Cmo?uv>l 0Ph#{;T[)G9,XdzT+M~unG!M6A1R)}Jbu3QUC}&+~/taon{~U{9}' ); define( 'SECURE_AUTH_SALT', ')]#jI2IJZySp)b<Io~!xwY%ADUmXbbl^AH#gty({Bhjl4XsjJPw+1[?r/](6^Q8}' ); define( 'LOGGED_IN_SALT', '}T:i=Y_9ET#(uWLLu$u?p1k{V1M7t$@0=XX}!>lIa>T.[E>$4$s6 EF#>F+L;O,S' ); define( 'NONCE_SALT', 'uf3S3C.]HaSPazeZgM^HNTLb<v63QFhT[t`W|`qZL$MdrY/$bOljiU^PaFb~=En:' ); /**#@-*/ /** * WordPress database table prefix. * * You can have multiple installations in one database if you give each * a unique prefix. Only numbers, letters, and underscores please! */ $table_prefix = 'wp_'; /** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. * * For information on other constants that can be used for debugging, * visit the documentation. * * @link https://wordpress.org/support/article/debugging-in-wordpress/ */ define( 'WP_DEBUG', false ); /* Add any custom values between this line and the "stop editing" line. */ /* That's all, stop editing! Happy publishing. */ /** Absolute path to the WordPress directory. */ if ( ! defined( 'ABSPATH' ) ) { define( 'ABSPATH', __DIR__ . '/' ); } /** Sets up WordPress vars and included files. */ require_once ABSPATH . 'wp-settings.php';
  • The same request in Postman
    enter image description here

  • In Postman I am disabling the SLL certificate, just because I want to see the request succeed, but I'd of course rather use it

  • I have tried to call both localhost on port 443 and 80 but I get the same result

This is the first time I try to do something like this, so if you need any extra piece of information just let me know it.

Thanks in advance for any help :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

橘虞初梦 2025-01-30 19:03:16

我终于找到了答案。

基于WordPress中的永久链接设置,我必须更改https:// localhost/do-pizza/graphql https://localhost/does-pizza/index.php? /代码>

I have finally found the answer.

Based on the Permalink settings in WordPress, I had to change https://localhost/does-pizza/graphql to https://localhost/does-pizza/index.php?graphql

予囚 2025-01-30 19:03:16

要添加到此最佳答案:使用localhost/index.php?graphql endpoint而不是localhost/graphql也是如此。

To add onto this top answer: same goes for using localhost/index.php?graphql endpoint instead of localhost/graphql

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文