factorial-io / phabalicious

Supports your deployments and every-day devops-tasks
http://docs.phab.io
MIT License
18 stars 3 forks source link

Allow serving a website from a subfolder #115

Closed mgrsskls closed 3 years ago

mgrsskls commented 3 years ago

When a website should be served from a subfolder (e.g. https://example.com/project) we solved this locally by creating a symlink (in Laravel projects: public/project -> .). This works fine and http://project.test/project serves all assets correctly, but http://project.test serves them as well. What happened to us was that we had a bug which caused the assets to be served by http://project.test which we did not notice (only noticeable by having a detailed look at the request in the devtools). Instead we thought they would be served by http://project.test/project and everything worked correctly.

Therefore having the option to serve a website and all of its assets from a subfolder and returning a 404 for all requests from the parent folders would be cool!

stmh commented 3 years ago

This is already possible (but not through phabalicious, but using multibasebox/ haproxy-config)

Add the environment-variable VPATH to your docker-compose.yml as in this example:

version: "2"
services:
  web:
    image: factorial/drupal-docker:php-74
    volumes:
      - .:/var/www:cached
    environment:
      VHOST: $VHOST
      VPATH: /xxx # <-- traffic to this path will be remapped from /xxx/bla to /bla and forwarded into that container
...

The current version of haproxy-config will report a statuscode 200 for requests to VHOST (it displays basically the dashboard) But we can change that

stmh commented 3 years ago

created a ticket here https://github.com/factorial-io/haproxy-config/issues/10