Skip to content

Can't proxy request when target server is HTTPS #160

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

Closed
OliverJAsh opened this issue Jan 10, 2017 · 6 comments
Closed

Can't proxy request when target server is HTTPS #160

OliverJAsh opened this issue Jan 10, 2017 · 6 comments

Comments

@OliverJAsh
Copy link

Hi,

I have a server running at https://localhost:9000. I added this as an alias in hotel:

❯ cat ~/.hotel/servers/cubik.json
{
  "target": "https://localhost:9000"
}

However, when I try to access the alias cubik.dev, I get this response:

Can't proxy request to https://localhost:9000

Accessing https://localhost:9000 works fine.

I tried with a different server on HTTP and that seemed to work OK, so I'm not sure what the problem could be.

Here is my daemon log, if that helps:

10 Jan 09:11:51 - Resolve cubik
10 Jan 09:11:51 - Proxy http://cubik.dev to https://localhost:9000
10 Jan 09:11:51 - Proxy error
10 Jan 09:11:52 - Resolve cubik
10 Jan 09:11:52 - Proxy http://cubik.dev to https://localhost:9000
10 Jan 09:11:52 - Proxy error
@typicode
Copy link
Owner

Hi @OliverJAsh,

There seem to be an issue when target is https. If you try proxying to http://localhost:9000, do you have the issue? You can still go https://cubik.dev.

@OliverJAsh
Copy link
Author

Thanks @typicode. That appears to be the issue. I'll update the title to reflect that.

@OliverJAsh OliverJAsh changed the title Can't proxy request Can't proxy request when target server is HTTPS Jan 10, 2017
@typicode
Copy link
Owner

Thank you.
I'll have a look, I'm almost sure it worked before so maybe it's related to a recent update.

@typicode typicode reopened this Jan 10, 2017
@typicode
Copy link
Owner

typicode commented Jan 10, 2017

When the request is proxied, host is cubik.dev and it may not match the hosts from your certificate.
If possible, I would create a dev certificate with cubik.dev in it and see if it works.

Next version of Hotel will show and log proxy errors to make debugging easier. Not sure yet how this case should be handled in Hotel.

@typicode
Copy link
Owner

Hi @OliverJAsh,

Just released v0.6.0, you can now pass --co/--change-origin when adding a remote server. It will change the host header to match the remote host. This should solve the case where host doesn't match the one in the certificate.

hotel add --co https://cubik.dev

@OliverJAsh
Copy link
Author

Thanks @typicode

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