Sage with MAMP - Media Library Images not working


I’m very new to Sage and enjoying it a lot so far. I just have an issue with the use of MAMP and Browsersync, as Browsersync proxies my MAMP URL of localhost:8888 and uses the URL localhost:3000. This is causing issues for me when I try to add images to a page, which are generated from a plugin I created that adds theme options to the admin area. The plugin is just using Upload fields for the user to upload some images.

When I try to echo those images URL into a page , WordPress puts localhost:3000 URL, however the images actually exist on the localhost:8888 URL.

I’ve changed the Gulp Browsersync task to not include a Proxy flag, which then prompts me to place a script tag before the footer, but this doesn’t solve the problem, images are still being linked from localhost:3000 instead of localhost:8888. Can anyone with experience in Sage and MAMP help me out?

(I know I should be using Bedrock, but I just wanted to try Sage with MAMP before changing my whole workflow over to Bedrock.).

Don’t login using the Browsersync URL. That should be used as a viewing URL only. Log in as the original, WordPress URL.

When I run ‘gulp watch’ Gulp will will automatically open and watch a tab running on localhost:3000? I’ve tried pointing Browsersync to MAMP’s port of 8888, but it’s obviously taken by MAMP already, so Browsersync and Gulp automatically switches to port 8890. Am I missing something obvious?

Thanks Kalen.

just run http://localhost:3000 along side your local mamp url http://yousite:8888, if you need to log in to your site use http://yousite:8888 and only use http://localhost:3000 for viewing changes in browser sync.

You don’t need to (or want to) change any of the default browser sync settings

1 Like

^ What @erikkowalski said. What I meant was don’t log in to the WP Admin with localhost:3000, as you want images being uploaded with the correct URL, in your case localhost:8888.

Ohh, I see! It seems to work fine now :smile: I knew it was something obvious that I was missing.

Thanks a lot for your help guys, much appreciated!