Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BrowserSync with Nginx and Traefik Reverse Proxy #1506

Open
2 tasks done
mikedoubintchik opened this issue Feb 4, 2018 · 0 comments
Open
2 tasks done

BrowserSync with Nginx and Traefik Reverse Proxy #1506

mikedoubintchik opened this issue Feb 4, 2018 · 0 comments

Comments

@mikedoubintchik
Copy link

Issue details

I'm trying to use the Sage 9 theme (or any gulp/webpack browsersync workflow) with my modified version of Docker4Wordpress - Docker Starter
.

The problem seems to be that browsersync is not find the right reference for what container to proxy since my docker setup is using Traefik for reverse proxy.

I tried using the name of the nginx container, but that's not working. Maybe I need to expose some port or my reference to the nginx container is incorrect?

Steps to reproduce/test case

Webpack config

new BrowserSyncPlugin({
      target,
      open: config.open,
      proxyUrl: config.proxyUrl,
      watch: config.watch,
      delay: 500,
}),

Webpack variables

The devUrl is the name of my nginx container

  "devUrl": "mike_nginx_1",
  "proxyUrl": "http://localhost:3000",

Docker-compose.yml (relevant parts)

  nginx:
    image: wodby/wordpress-nginx:4-1.13-3.0.2
    environment:
      NGINX_STATIC_CONTENT_OPEN_FILE_CACHE: "off"
      NGINX_ERROR_LOG_LEVEL: debug
      NGINX_BACKEND_HOST: php
    expose:
      - 80
      - 443
    volumes:
      - $PWD/www:/var/www/html
    depends_on:
      - php
    labels:
      - 'traefik.backend=mike_nginx'
      - 'traefik.port=80'
      - 'traefik.frontend.rule=Host:mike.docker.localhost'

Traefik config

  traefik:
    image: traefik
    command: -c /dev/null --web --docker --logLevel=DEBUG
    networks:
${NETWORK_LIST}
    ports:
      - '80:80'
      - '443:443'
      - '8080:8080'
      - '8025:8025'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    restart: unless-stopped

networks:
${NETWORK_SECTION}

Please specify which version of Browsersync, node and npm you're running

  • Browsersync [ 2.18 ]
  • Node [ 6.12.3 ]
  • Npm [ 5.6.0 ]

Affected platforms

  • OS X

Browsersync use-case

  • Webpack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant