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

Not able to use https protocol getting net::ERR_CONNECTION_REFUSED in browser #867

Open
vasanth-kumar-m-y opened this issue Jan 28, 2024 · 0 comments

Comments

@vasanth-kumar-m-y
Copy link

vasanth-kumar-m-y commented Jan 28, 2024

Hi
I am using symfony 4.4 (legacy, not flex) inside an vagrant machine, which is setup to use Apache web server and have self signed ssl certificates to run it over https. Same goes to client side an angular application inside vagrant machine with self signed ssl on https.

Have installed mercure bundle for real time data push to client application. Have downloaded the latest static binary and placed the binary hub at the root of the project. Everything works fine with http protocol (http://my.api.local:3000/.well-known/mercure) but when i change this to https protocol (https://my.api.local:3000/.well-known/mercure) getting net::ERR_CONNECTION_REFUSED error while subscribing for updates from browser.

Starting the mercure using command: (using 0.0.0.0 as its inside vagrant to listen to all ips)

`MERCURE_PUBLISHER_JWT_KEY='!someSecretKey!' MERCURE_SUBSCRIBER_JWT_KEY='!someSecretKey!' ./mercure run --config Caddyfile.dev
`

Set env variables in parameter.yaml:

env(MERCURE_URL): https://my.api.local:3000/.well-known/mercure
env(MERCURE_PUBLISHER_JWT_KEY): '!someSecretKey!'
env(MERCURE_SUBSCRIBER_JWT_KEY): '!someSecretKey!'
env(MERCURE_JWT_TOKEN): 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjdXJlIjp7InB1Ymxpc2giOlsiKiJdfX0.nFIuQOrDGSudHFiod2QeVjlvpo88tjKioZdGTArIETY'

Set up in config.yaml:

mercure:
    enable_profiler: '%kernel.debug%'
    hubs:
        default:
            url: '%env(MERCURE_URL)%'
            jwt: '%env(MERCURE_JWT_TOKEN)%'

caddyfile.dev

# Learn how to configure the Mercure.rocks Hub on https://mercure.rocks/docs/hub/config
{
	order mercure after encode

	http_port 3000
	https_port 3001
	auto_https disable_redirects

	{$GLOBAL_OPTIONS}
}

{$CADDY_EXTRA_CONFIG}

{$SERVER_NAME:my.api.local:3000} {
	log {
		format filter {
			# Defaults to console while waiting for https://github.com/caddyserver/caddy/pull/5980
			wrap console
			fields {
				uri query {
					replace authorization REDACTED
				}
			}
		}
	}

	encode zstd gzip

	mercure {
		# Transport to use (default to Bolt)
		transport_url {$MERCURE_TRANSPORT_URL:bolt://mercure.db}
		# Publisher JWT key
		publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG}
		# Subscriber JWT key
		subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG}
		# Permissive configuration for the development environment
		cors_origins *
		publish_origins *
		demo
		anonymous
		subscriptions
		# Extra directives
		{$MERCURE_EXTRA_DIRECTIVES}
	}

	{$CADDY_SERVER_EXTRA_DIRECTIVES}

	redir / /.well-known/mercure/ui/

	respond /healthz 200
	respond /robots.txt `User-agent: *
Disallow: /`
	respond "Not Found" 404
}
@vasanth-kumar-m-y vasanth-kumar-m-y changed the title Not able to use https protocol getting ssl connect error Not able to use https protocol getting ssl connection error Jan 28, 2024
@vasanth-kumar-m-y vasanth-kumar-m-y changed the title Not able to use https protocol getting ssl connection error Not able to use https protocol getting ERR_CONNECTION_REFUSED in browser Feb 2, 2024
@vasanth-kumar-m-y vasanth-kumar-m-y changed the title Not able to use https protocol getting ERR_CONNECTION_REFUSED in browser Not able to use https protocol getting net::ERR_CONNECTION_REFUSED in browser Feb 2, 2024
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

1 participant