JeroenBoersma / docker-compose-development

Clone and `bin/dev up`. Quickly start of developing locally with Nginx, PHP, Blackfire, Percona, Mailhog and Redis. Out of the box support for Magento2 Developer Box
MIT License
207 stars 63 forks source link

MAGE_RUN_CODE has not been set #145

Closed tgigli-trezo closed 3 years ago

tgigli-trezo commented 3 years ago

Hi there, I had to configure a magento1 env to run the desktop and mobile stores which usually runs under https://somestorename.com.br and https://m.somestorename.com.br. In production, at the nginx configuration, the var MAGE_RUN_CODE for the mobile store is set to "mobile" and "" for the desktop store. Trying to run the same env at the docker-compose-development, I have changed the URL for desktop store to https://somestorename.magento.localhost/ and https://somestorename.magento.mobile.localhost/ for mobile, but it did not work as expected. Printing _SERVER variables I've got that the MAGE_RUN_CODE has been set as an empty string.

I've tryied:

  1. Change the /etc/nginx/content/magento1 at line 2 and hard-coding set $mageRunCode "mobile"; But the _SERVER['MAGE_RUN_CODE'] is still = ""

  2. Change the /etc/nginx/content/upstream at the line 17 and hard-coding fastcgi_param MAGE_RUN_CODE "mobile"; And that worked well. So... I am not sure where this variable $mageRunCode is losing its value

I will still trying to discover

tgigli-trezo commented 3 years ago

I discovered that copying the following block from /etc/nginx/content/magento1 to the /etc/nginx/content/upstream file, it works as expected. May be an scope variable issue.

set $mageRunCode "";
if ($host ~ "^([^\.]+\.){2}(?!magento\.)([^\.]+).*\.localhost$") {
     set $mageRunCode "$2";
}  
JeroenBoersma commented 3 years ago

Hi @tgigli-trezo, thanks for brining this up... Good you've found a solution yourself already.

We load configuration files only if needed, it's recognized based on the domain extension:

Your https://somestorename.magento.mobile.localhost/ doesn't match *.magento.localhost anymore so it falls back to default php projects.

https://somestorename.magento.mobile.magento.localhost/ <- just add an extra .magento would do the trick Which will do:

tgigli-trezo commented 3 years ago

For some reason, this is not working

https://somestorename.magento.mobile.magento.localhost/ <- just add an extra .magento would do the trick Which will do:

  • path workspace/somestorename/magento

  • mageruncode mobile

mageruncode brings an empty value

Em ter., 6 de abr. de 2021 às 04:07, Jeroen Boersma < @.***> escreveu:

Hi @tgigli-trezo https://github.com/tgigli-trezo, thanks for brining this up... Good you've found a solution yourself already.

We load configuration files only if needed, it's recognized based on the domain extension:

  • *.magento.localhost -> magento1
  • *.magento2.localhost -> magento2

Your https://somestorename.magento.mobile.localhost/ doesn't match *.magento.localhost anymore so it falls back to default php projects.

https://somestorename.magento.mobile.magento.localhost/ <- just add an extra .magento would do the trick Which will do:

  • path workspace/somestorename/magento
  • mageruncode mobile

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JeroenBoersma/docker-compose-development/issues/145#issuecomment-813879661, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARDVJTR6FMBO7WNN4YCAGFDTHKXKVANCNFSM4ZXX5M4Q .

--

Tiago Gigli (15) 981 064 086 @.***

[image: https://solutionpartners.adobe.com/fragments/partners/a1X1O00000Am4bxUAB.html] https://solutionpartners.adobe.com/fragments/partners/a1X1O00000Am4bxUAB.html

Confidencialidade: A informação contida nesta mensagem de e-mail, incluindo quaisquer anexos, é confidencial e está reservada apenas à pessoa ou entidade para a qual foi endereçada. Se você não é o destinatário ou a pessoa responsável por encaminhar esta mensagem ao destinatário, você está, por meio desta, notificado que não deverá rever, retransmitir, imprimir, copiar, usar ou distribuir esta mensagem de e-mail ou quaisquer anexos. Caso você tenha recebido esta mensagem por engano, por favor, contate o remetente imediatamente e apague esta mensagem de seu computador ou de qualquer outro banco de dados.

JeroenBoersma commented 3 years ago

Don't know what to say :hushed:

Created a movie with a fresh install to verify, maybe I made a typo somewhere in my previous communication. asciicast