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

Fix :host mount option #976

Merged
merged 5 commits into from Sep 13, 2019
Merged

Fix :host mount option #976

merged 5 commits into from Sep 13, 2019

Conversation

AlfonsoUceda
Copy link
Contributor

This PR fix #951

@@ -62,7 +62,9 @@ def call(env)
# @api private
def mount(configuration)
configuration.mounted.each do |klass, app|
routes.mount(klass, at: app.path_prefix)
# TODO: think if this line is in the correct place
host = [app.host, Components['environment'].host].compact.join('.') if Components['environment'].host != 'localhost'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlfonsoUceda Why we can't just forward the given host?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not added a spec yet but the problem is when you combine option :host in mount DSL and option --host in server command.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested this patch without --host param with lvh.me and it works. no need for this special joining of mount host and env host. if something like this is supposed to be a feature i'd introduce something like:

mount HelloWorld::Application, at: "/", subdomain: "hello-world"

which would serve requests like https://hello-world.example.com while the host depends on the request's host header if no host: "..." option was given for the mount.

@jodosha jodosha modified the milestones: v1.3.1, v1.3.2 Jan 18, 2019
@AlfonsoUceda AlfonsoUceda deleted the fix-mount-host branch February 20, 2019 09:16
@checkbutton
Copy link

Why was this closed and never merged? @jodosha @AlfonsoUceda

@cllns cllns restored the fix-mount-host branch July 17, 2019 22:43
@cllns
Copy link
Member

cllns commented Jul 17, 2019

@checkbutton Sorry about that! I've restored the branch and I'm re-opening the PR. I'm not sure why it was closed. It might've been a mistake but if it's not @AlfonsoUceda can close it again and give a brief explanation.

Also, for your info, Hanami 2.0 will have an entirely new router. This should definitely work on 1.3 though, before that gets released.

@cllns cllns reopened this Jul 17, 2019
@jodosha jodosha self-requested a review July 22, 2019 09:09
@jodosha jodosha modified the milestones: v1.3.2, v1.3.3 Jul 23, 2019
@AlfonsoUceda
Copy link
Contributor Author

@checkbutton this was a proof of concept to understand the problem and if I could make it work. It works fine if I remember well but I never finished tests. I asked @jodosha if he can take a look ;)

@jodosha jodosha self-assigned this Sep 13, 2019
@jodosha jodosha merged commit 2592382 into master Sep 13, 2019
@jodosha jodosha deleted the fix-mount-host branch September 13, 2019 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mounting on a subdomain is broken
5 participants