-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
proxy client side urls #155
Comments
Hello, Have you tried this https://wpack.io/tutorials/customizer-and-rest/ |
Hi, What i need to find is a way to proxy client requests for the source wp dev server to the wpack.io server. (e.g request made by clicking links like It seems that it might be possible to use the In looking at browserync i see a couple possibilities: the However, i don't think that the Also, I don't have a clear understanding of if/how the browsersync server interacts with webpack and if configuring the webpack proxy option settings in any thoughts or advice are appreciated. |
Maybe what you need is the BrowserSync/browser-sync#373 (comment) So in your module.exports = {
// ...
bsOverride: {
snippetOptions: {
whitelist: ["/wp-json/**"]
}
} Do play with it. I have knowingly kept |
Also let me know if you have any success. I am thinking this is essential for any API driven APP development and it should be processed correctly. If the above works, then I will make it default in coming version. |
Hi, this worked great once I updated wpack.io to the latest version. Thank you very much for your help. As a side note, and this may be a separate issue to file, but is there a best approach to updating the wpack.io tooling? I wasn't able to find any docs on doing so. My first attempt to just update wpack.io is an excellent tool, and it would be great to have a way to keep it up to date without breaking previous customizations. thanks again for your help. |
Hello, I am glad that the solution worked. I will have it as default for development server and will also perhaps whitelist About update, yes doing When you run |
When rendering site permalinks on the client side, the absolute urls are not mapped back to the wpack.io proxy server.
For example, using the REST api to retrieve post data, peramlinks are returned relative to the local wp dev server. When these links are rendered on the client, the do not get proxied to the wpack.io server and so following the url will ink out of the wpack.io server proxy.
To be clear: if my dev server is hosted at
http://wp-dev.test
and is being proxied by wpack io to something likehttp://192.168.2.1
, my rest api is returning data with permalinks likehttp://wp-dev.test/permalink-post
.I've tried configureing webpack proxy setting inside of
wpackio.project.js
like so:but have not had any luck with that approach. Is there a way to configure webpack to catch these client-rendered urls and proxy them back to the wpack.io proxy server ? eg:
http://192.168.2.1/permalink-post
?many thanks.
The text was updated successfully, but these errors were encountered: