barnacs / compy

HTTP/HTTPS compression proxy
ISC License
206 stars 34 forks source link

Using Compy Locally #61

Closed jameesjohn closed 4 years ago

jameesjohn commented 4 years ago

Hi

I tried setting up compy to serve compressed assets locally and I'm running into issues (probably with the way I'm using it).

Steps to reproduce

  1. Create a simple HTML file containing anything you want.
  2. Serve the file via a simple server (I use live-server which can be installed via npm) running on port 8080.
  3. Run compy on the same port (8080).

Error

2020/04/20 13:45:03 compy listening on :8080 2020/04/20 13:45:03 listen tcp :8080: bind: address already in use james@james-pc:~/Desktop/testing-compy$

Setup

OS: Ubuntu 18.04 Go version: 1.14.1

gaul commented 4 years ago

If you run a simple file server that listens on port 8080 then compy cannot also listen on port 8080. Consider using 8081 instead.

jameesjohn commented 4 years ago

@gaul, the problem is to get compy to serve the assets from the file server.

gaul commented 4 years ago

You can't have two services listening on the same port. Imagine you were running two instances of your simple npm server on port 8080. How would a client connect to one or the other if they have the same port number? You must use different port numbers.

jameesjohn commented 4 years ago

Yeah Thanks, @gaul. I've been able to get it to work by setting the proxy server on chromium. I didn't know that could be set so using different ports works.

Thanks.