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

Support for a custom "binds" argument to the Rails server #61

Open
patbl opened this issue Mar 18, 2021 · 1 comment
Open

Support for a custom "binds" argument to the Rails server #61

patbl opened this issue Mar 18, 2021 · 1 comment

Comments

@patbl
Copy link

patbl commented Mar 18, 2021

Puma and Rails support a "binds" argument that's useful for SSL support. For example:

bundle exec rails s -b 'ssl://127.0.0.1:3000?key=/etc/nginx/server.key&cert=/etc/nginx/server.crt'

Is there a way of passing this argument through Cypress Rails? I tried using CYPRESS_RAILS_HOST but results in this error:

CYPRESS_RAILS_HOST='ssl://127.0.0.1:3000?key=/etc/nginx/server.key&cert=/etc/nginx/server.crt' bundle exec cypress-rails run

cypress-rails configuration:
============================
 CYPRESS_RAILS_DIR....................."/home/ubuntu/code/academia-app"
 CYPRESS_RAILS_HOST...................."ssl://127.0.0.1:3000?key=/etc/nginx/server.key&cert=/etc/nginx/server.crt"
 CYPRESS_RAILS_PORT....................nil
 CYPRESS_RAILS_BASE_PATH..............."/"
 CYPRESS_RAILS_TRANSACTIONAL_SERVER....true
 CYPRESS_RAILS_CYPRESS_OPTS............""

bundler: failed to load command: cypress-rails (/home/ubuntu/code/rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bin/cypress-rails)
SocketError: getaddrinfo: Name or service not known
  /home/ubuntu/code/rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/cypress-rails-c0709714f040/lib/cypress-rails/server.rb:102:in `initialize'
  /home/ubuntu/code/rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/cypress-rails-c0709714f040/lib/cypress-rails/server.rb:102:in `new'
  /home/ubuntu/code/rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/cypress-rails-c0709714f040/lib/cypress-rails/server.rb:102:in `find_available_port

That's because it's calling TCPServer.new("ssl://127.0.0.1:3000?key=/etc/nginx/server.key&cert=/etc/nginx/server.crt", 0), and I think you can pass only the host (not the protocol, port, or query parameters) when calling TCPServer.new.

I tried adding another environment variable to override the host value. It seems to work, though I'm running into another issue (perhaps #18), and I'm not sure that doing that doesn't cause other problems.

Alternatively, is there another way you recommend for getting SSL to work with Cypress?

@searls
Copy link
Member

searls commented Mar 20, 2021

I think this makes sense -- if you're able to get an environment working locally to work on a PR for the proposed environment variable, I'll do my best to help you shepherd it through

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

2 participants