+
Skip to content

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

Open
@vasanth-kumar-m-y

Description

@vasanth-kumar-m-y

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载