shkoliar / magento-ngrok

Magento 2 module for ngrok.io service support
https://shkoliar.com
MIT License
46 stars 22 forks source link

Incorrect URLs after first page load #4

Closed jamiethorpe closed 4 years ago

jamiethorpe commented 4 years ago

I've been able to successfully load the first page of my site, but every link that is generated after that points to my usual localhost URL rather than my ngrok URL.

I notice in StoreBaseUrl::afterGetBaseUrl() that the $result is https://local.mydevsite.com/index.php/en_CA/ and thus isn't getting picked up in the conditional on line 48. That being said, I'm not sure that it's supposed to be since it isn't technically a base URL at that point. I also tried removing the first part of the condition to force it to use the ngrok URL, and that does work, but none of the static assets load, so I'm not able to test properly.

The only other thing I could think of was my nginx config, but I don't see anything obvious there (I've attached it in case you have time to look at it). Do you have any ideas?

I forgot to mention, my Magento version is 2.3.3. I'm sure this works on a clean install, so I'm hoping you might be able to wager a guess as to what I could look at changing.

anon_nginx.txt

jamiethorpe commented 4 years ago

I was able to get this working on my setup (so far) by replacing line 48 of StoreBaseUrl.php with: if (!strpos($result, 'static') && $ngrokDomain = $this->ngrok->getDomain())

vestman commented 4 years ago

I was able to get this working on my setup (so far) by replacing line 48 of StoreBaseUrl.php with: if (!strpos($result, 'static') && $ngrokDomain = $this->ngrok->getDomain())

This worked for me as well.