Skip to content
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

Gutenberg tries to access the WP Rest API using Site Address, not Wordpress Address #9044

Closed
kettula opened this issue Aug 16, 2018 · 2 comments
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.

Comments

@kettula
Copy link

kettula commented Aug 16, 2018

I am using Wordpress as a backend for an SPA developed in react. The client application lives in a different domain (ie. www.mydomain.com) from the Wordpress installation (ie. api.mydomain.com). To correctly display permalinks on the admin side, I have configured the Wordpress Address to point to the domain where WP is located, and the Site Address to the client.

I activated the Gutenberg plugin from the WP repository, and when editing a post, I get a blank edit view with a cross-domain error in the console, as it tries to access the WP Rest API using the Site Address (the client's domain). Is this expected behavior? I would assume that it should search for the API from the Wordpress Address?

Console error output:

Failed to load https://www.mydomain.com/wp-json/wp/v2/: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://api.mydomain.com' is therefore not allowed access.

Gutenberg plugin version: 3.5.0
Wordpress version: 4.9.8

@eliorivero
Copy link
Contributor

Related to #1761

Gutenberg uses rest_url and get_rest_url so a temporary workaround–not saying it's a final solution–is to filter the URL as mentioned in the other issue.

@designsimply designsimply added the [Type] Help Request Help with setup, implementation, or "How do I?" questions. label Aug 16, 2018
@designsimply
Copy link
Member

Closing in favor of #1761.

@kettula please let me know if you feel we shouldn't consolidate to #1761 and #9044 should be reopened.

@eliorivero thank you for responding with a workaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.
Projects
None yet
Development

No branches or pull requests

3 participants