-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby-source-wordpress): fix WP-API-MENUS when reported endpoint url doesn't match base url #12859
fix(gatsby-source-wordpress): fix WP-API-MENUS when reported endpoint url doesn't match base url #12859
Conversation
Are you able to test changes from #10624 ? It touches similar problem and it might fix this issue as well. It changes how endpoint urls are created - instead of using self links - it will use base url (for self hosted wordpress it will be url from config + |
@STUkh Can you try using |
@pieh, thanks for answer, will try. |
@pieh , now It works better, but fails in menus fetching |
@STUkh We are getting close ;) gatsby/packages/gatsby-source-wordpress/src/fetch.js Lines 294 to 308 in 632f035
Seems like this references |
e7c1f4a
to
e3e8d1a
Compare
@pieh updated PR content because of new PRs was merged. Fixed menus paths. Docker example project to reproduce bug: https://github.com/STUkh/gatsby-wordpress-docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @STUkh! Sorry I lost track of it, but just verified it and added some basic unit tests (mostly to document how it should behave rather than test it)
Holy buckets, @STUkh — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
Description
This PR fixes case when wordpress site URL exists behind proxy or in docker-container with it's local own address and route.self links give us wrong URL that gatsby-source-wordpress try to fetch (and obviously fails).
Related Issues
For me it's fixes intercontainer communication, when wordpress hosted inside of docker with internal address http://localhost:8080, but for exposes as http://wordpress:8080 for other containers. Base URL fetched properly by gatsy-source-wordpress, but all internal self links are broken because rely on
localhost
instead of desiredwordpress
base host.I see it should fixe the same problem described in #10427