warden icon indicating copy to clipboard operation
warden copied to clipboard

Problems with multiple websites with multiple top level domains

Open norgeindian opened this issue 3 years ago • 11 comments

I followed https://docs.warden.dev/configuration/multipledomains.html?highlight=multiple#multiple-domains to make sure that my domains app.base.test and app.alternative.test are handled correctly.

Step 2 of this documentation links both domains to the same warden project as far as I understand.

Now I want to set the proper MAGE_RUN_CODE in Magento1 resp. Magento2 based on the incoming domain. In Magento 1 I try to use a custom nginx.conf file to set the correct code.

This is included in images/nginx/context/etc/nginx/conf.d/default.conf inside the server block. But whatever I do there, I can not add a new server in my custom configuration to handle the traffic accordingly and with location blocks I'm not able to get the top level domains, as I only have access to the URI there. Is there a way to solve that, which I did not get yet? If not, it would be great to have the possibility to add a custom server block for that issue. So maybe we could add a new include statement outside the server block?

In Magento2 I followed the approach including app/etc/stores.php. Unfortunately the host is already app.base.test, when I call app.alternative.test at this point. So it seems as if this has been changed already by the .warden/warden-env.yml adaption. Am I missing something here as well or does the Magento2 approach only work for domains like domain1.exampleproject.test and never for completely different top level domains?

norgeindian avatar Apr 23 '21 12:04 norgeindian

I could really use a bit of help here. Could someone give a short hint what I could check / adapt?

norgeindian avatar May 19 '21 07:05 norgeindian

@davidalger Do you see any possible solutions to this?

BorisovskiP avatar Jun 04 '21 08:06 BorisovskiP

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Sep 02 '21 09:09 stale[bot]

I'm new to Warden and also interested in a solution for this scenario.

stuartfranke avatar Sep 03 '21 12:09 stuartfranke

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Dec 02 '21 17:12 stale[bot]

@davidalger mind having a look at this?

BorisovskiP avatar Dec 03 '21 07:12 BorisovskiP

@davidalger , it would be awesome to get some help here, as this issue is really bugging us. Maybe you have a small hint, what we could try? Then we will be happy to dive deeper into that and also prepare a PR for the docs

norgeindian avatar Jan 03 '22 08:01 norgeindian

@davidalger I'm stucked as other people here as well. Somebody has maybe found a way to have it working?

maverickk89 avatar Mar 23 '22 15:03 maverickk89

@maverickk89 , we actually got it to work now, but did not find the time to add it to the docs. You need to create a '.warden/warden-env-yml' with the following content:

version: "3.5"
services:
  varnish:
    labels:
      - traefik.http.routers.${WARDEN_ENV_NAME}-varnish.rule=
        HostRegexp(`{subdomain:.+}.{{YOUR_ALTERNATIVE_URL}}.test`)
        || Host(`${TRAEFIK_DOMAIN}`)
        || Host(`{{YOUR_ALTERNATIVE_URL}}.test`)
        || HostRegexp(`{subdomain:.+}.${TRAEFIK_DOMAIN}`)
  nginx:
    labels:
      - traefik.http.routers.${WARDEN_ENV_NAME}-nginx.rule=
        HostRegexp(`{subdomain:.+}.{{YOUR_ALTERNATIVE_URL}}.test`)
        || Host(`${TRAEFIK_DOMAIN}`)
        || Host(`{{YOUR_ALTERNATIVE_URL}}.test`)
        || HostRegexp(`{subdomain:.+}.${TRAEFIK_DOMAIN}`)

Then you only need to run warden sign certificate {{YOUR_ALTERNATIVE_URL}}.test and you should be ready to go. Feel free to get in touch with me, if you need further help at a specific point.

norgeindian avatar Mar 24 '22 11:03 norgeindian

I created a PR which adds this to the documentations.

BorisovskiP avatar Jun 09 '22 12:06 BorisovskiP

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Sep 16 '22 23:09 stale[bot]