Project

ser

0.0
No release in over 3 years
Ser(ve) your web app with HTTPS to any device on your network (mDNS): 1. Use convenient domain names without ports (https://app.local vs http://127.0.0.1:3000); 2. Use mDNS for .local domains, so you can visit them from your phone or any other device connected to the same network; 3. Locally-trusted development certificates (read on filosottile/mkcert how to trust certificates on mobile devices). Use-cases: 1. Simulate production-like subdomains (e.g., blog.example.com, api.example.com); 2. Test cookies scoped to specific domains; 3. Preview multi-tenant routing (e.g., tenant1.example.com, tenant2.example.com); 4. Use third-party APIs that need HTTPS.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Ser


Ser(ve) your web app with HTTPS to any device on your network (mDNS):

  • Use convenient domain names without ports (https://app.local vs http://127.0.0.1:3000)
  • Use mDNS for .local domains, 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/ser

Ser 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 ser

Usage

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 test

Running || Building

You can run the application using go run:

go run ./cmd/ser

You can also build for the current environment (bin/) using the Makefile:

make build

To build binaries for all supported architectures and operating systems (dist/), use:

make dist

Releasing

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
  • 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.