Ser
Ser(ve) your web app with HTTPS to any device on your network (mDNS):
- Use convenient domain names without ports (
https://app.localvshttp://127.0.0.1:3000) - Use mDNS for
.localdomains, so you can visit them from your phone or any other device connected to the same network - Locally-trusted development certificates (read on filosottile/mkcert how to trust certificates on mobile devices)
Use-cases:
- Simulate production-like subdomains (e.g.,
blog.example.com,api.example.com) - Test cookies scoped to specific domains
- Preview multi-tenant routing (e.g.,
tenant1.example.com,tenant2.example.com) - Use third-party APIs that need HTTPS
Installation
You can install ser with Go:
go install github.com/3v0k4/serSer is also distributed as a Ruby gem. Because Ser is written in Go, several pre-built platform-specific binaries are available. Installing the gem will automatically fetch the appropriate binary for your platform.
To install it, add it to your application's Gemfile:
gem 'ser'Or install it globally:
$ gem install serUsage
If your app server listens on http://localhost:3000, you can just run ser [APP-SERVER] and visit https://ser.local on any device connected to the same network.
Otherwise, you can customise the addresses with ENVs:
Usage: ser CMD
Ser(ve) your web app with HTTPS to any device on your network (mDNS):
Provisions HTTPS certificates for FROM
Executes CMD
Proxies requests from FROM to TO
Starts a mDNS server to announce FROM (if .local)
Arguments:
CMD the command that launches the app server (it must expect requests at TO)
ENVs:
FROM (default: https://ser.local) comma-separated HTTPS domains you want to access
SER_FROM same as above but takes precedence
TO (default: http://localhost:3000) address where CMD expects requests
SER_TO same as above but takes precedence
Examples:
ser bundle exec rails server
# Access the Rails app at https://ser.local (from your phone)
FROM=https://app.local TO=http://127.0.0.1:8080 ser npm run start
# Access the Node app at https://app.local (from your phone)Development
Testing
make testRunning || Building
You can run the application using go run:
go run ./cmd/serYou can also build for the current environment (bin/) using the Makefile:
make buildTo build binaries for all supported architectures and operating systems (dist/), use:
make distReleasing
In order to ship the platform-specific binary inside a gem, multiple gems are released, one for each platform. The rake release task builds all the necessary gems.
Checklist:
-
Update version & changelog:
- Update
lib/ser/version.rb - Update
CHANGELOG.md - Commit and
git tag vX.Y.Z
- Update
-
Build native gems:
-
rake clobber(to clean up any old packages) -
rake package
-
-
Push gems:
-
for g in pkg/*.gem ; do gem push $g ; done -
git push
-
Contributing
Bug reports and pull requests are welcome on GitHub.
License
The module is available as open source under the terms of the MIT License.
