Customizing Development URLs

This guide will walk you through how to customize your development URLs in with Spin Pro. Instead of using laravel.dev.test, you can use my-awesome-project.test or any other domain you'd like.

How URLs are configured

We use Traefik as a reverse proxy to route traffic to your containers. Traefik uses labels in your docker-compose.*.yml files to determine how to route traffic.

There are labels that you can apply to your services to customize the URL. Here is an example of a service in your docker-compose.dev.yml file:

Default URL for PHP service in docker-compose.dev.yml

services:
  php:
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.laravel-web.rule=Host(`laravel.dev.test`) || HostRegexp(`^.+\\.ngrok-free\\.app$$`)"
      - "traefik.http.routers.laravel-web.tls=true"
      - "traefik.http.routers.laravel-web.entrypoints=websecure"
      - "traefik.http.services.laravel-web.loadbalancer.server.port=8080"
      - "traefik.http.services.laravel-web.loadbalancer.server.scheme=http"

You can see by default, we use laravel.dev.test as the URL, as long as supporting Ngrok's free plan by default. You can change this to any domain you'd like.

Updating the hosts file

Just remember, you'll need to add the domain to your hosts file to make sure your computer knows where to route the traffic.