When I change to use domain, it load forever #150

Closed
opened 2026-02-04 17:31:00 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @cmdntd on GitHub (Dec 16, 2021).

I try to change to sub-domain, and use reserve proxy from docker
It load forever at first black status page.

My error

WebSocket connection to 'wss://sub.domain.net/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=node&__sails_io_sdk_language=javascript&EIO=3&transport=websocket' failed:

Could you check this, please?

Originally created by @cmdntd on GitHub (Dec 16, 2021). I try to change to sub-domain, and use reserve proxy from docker It load forever at first black status page. My error ``` WebSocket connection to 'wss://sub.domain.net/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=node&__sails_io_sdk_language=javascript&EIO=3&transport=websocket' failed: ``` Could you check this, please?
Author
Owner

@devSparkle commented on GitHub (Dec 26, 2021):

I experienced this issue while setting up my instance too. Did you change the BASE_URL environment variable to the browsable subdomain, in your Planka docker configuration?

@devSparkle commented on GitHub (Dec 26, 2021): I experienced this issue while setting up my instance too. Did you change the `BASE_URL` environment variable to the browsable subdomain, in your Planka docker configuration?
Author
Owner

@cmdntd commented on GitHub (Dec 27, 2021):

Yes. I changed it.

BASE_URL=https://sub.mydomain.net
TRUST_PROXY=0

Then I tried to change TRUST_PROXY=1, it has the same issuse.

Coud I use SSL here?

@cmdntd commented on GitHub (Dec 27, 2021): Yes. I changed it. ``` BASE_URL=https://sub.mydomain.net TRUST_PROXY=0 ``` Then I tried to change TRUST_PROXY=1, it has the same issuse. Coud I use SSL here?
Author
Owner

@devSparkle commented on GitHub (Dec 30, 2021):

What kind of proxy are you setting up? In my case I was using NGINX, which requires the following headers be setup to function as a WebSocket proxy:

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
@devSparkle commented on GitHub (Dec 30, 2021): What kind of proxy are you setting up? In my case I was using NGINX, which requires the following headers be setup to function as a WebSocket proxy: ``` proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; ```
Author
Owner

@cmdntd commented on GitHub (Dec 30, 2021):

I use openlitespeed, and reserve proxy for docker

@cmdntd commented on GitHub (Dec 30, 2021): I use `openlitespeed`, and `reserve proxy` for docker
Author
Owner

@3615alexis commented on GitHub (Feb 16, 2022):

Hello,
I have the same issue here :

In Chrome :

WebSocket connection to 'wss://subdomain.domain.com/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=node&__sails_io_sdk_language=javascript&EIO=3&transport=websocket' failed: 

In Firefox :

GET wss://subdomain.domain.com/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=node&__sails_io_sdk_language=javascript&EIO=3&transport=websocket
[[HTTP/1.1 403 Forbidden 43ms]]()

On the contrary there is no error if I put BASE_URL=http://MY.LOCAL.IP:3000 (but I can't benefit from my domain)

Could this be linked to some config files, for instance server/config/env/production.js where we can declare 'onlyAllowOrigins' on websites allowed to open socket connections ? Could this be configurable from docker-compose.yml ?

sockets: {
    /**
     *
     * Uncomment the `onlyAllowOrigins` whitelist below to configure which
     * "origins" are allowed to open socket connections to your Sails app.
     *
     * > Replace "https://example.com" etc. with the URL(s) of your app.
     * > Be sure to use the right protocol!  ("http://" vs. "https://")
     *
     */

    onlyAllowOrigins: [
		new url.URL(process.env.BASE_URL).origin
	],

Thanks for your help

@3615alexis commented on GitHub (Feb 16, 2022): Hello, I have the same issue here : - I'm using planka via Docker - BASE_URL=https://subdomain.domain.com (same as what is configured in Apache conf) - and I got the same error : In Chrome : ``` WebSocket connection to 'wss://subdomain.domain.com/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=node&__sails_io_sdk_language=javascript&EIO=3&transport=websocket' failed: ``` In Firefox : ``` GET wss://subdomain.domain.com/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=node&__sails_io_sdk_language=javascript&EIO=3&transport=websocket [[HTTP/1.1 403 Forbidden 43ms]]() ``` On the contrary there is no error if I put BASE_URL=http://MY.LOCAL.IP:3000 (but I can't benefit from my domain) Could this be linked to some config files, for instance server/config/env/production.js where we can declare 'onlyAllowOrigins' on websites allowed to open socket connections ? Could this be configurable from docker-compose.yml ? ``` sockets: { /** * * Uncomment the `onlyAllowOrigins` whitelist below to configure which * "origins" are allowed to open socket connections to your Sails app. * * > Replace "https://example.com" etc. with the URL(s) of your app. * > Be sure to use the right protocol! ("http://" vs. "https://") * */ onlyAllowOrigins: [ new url.URL(process.env.BASE_URL).origin ], ``` Thanks for your help
Author
Owner

@3615alexis commented on GitHub (Feb 16, 2022):

Finally I made it work ! It was linked to a bad management of SSL for WebSocket protocol.

I ended up having this in my "docker-compose.yml":

environment:
      - BASE_URL=https://subdomain.domain.com
      - TRUST_PROXY=1

And I have this in my Apache conf (the RewriteCond in "location /" did make the trick) :

<VirtualHost *:80>
	ServerName subdomain.domain.com
	
	Redirect permanent / https://subdomain.domain.com/
	RewriteEngine on
	RewriteCond %{SERVER_NAME} =subdomain.domain.com
	RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
		
</VirtualHost>
<VirtualHost *:443>
	ServerName subdomain.domain.com

	Protocols h2 http/1.1
	
	SSLEngine On
	
	<Directory />
	  Options -Indexes +FollowSymlinks
	  AllowOverride None
	  Require all granted
	</Directory>

	ProxyRequests On
	ProxyVia Full
	<Proxy *>
	Require all granted
	</Proxy>
	
	<Location />
		ProxyPass http://MY.LOCAL.IP:3000/
		ProxyPassReverse http://MY.LOCAL.IP:3000/
		**RewriteEngine on
		RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
		RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
		RewriteRule /socket.io/(.*) ws://MY.LOCAL.IP:3000/socket.io/$1 [P]**
	</Location>
</VirtualHost>
@3615alexis commented on GitHub (Feb 16, 2022): Finally I made it work ! It was linked to a bad management of SSL for WebSocket protocol. I ended up having this in my "docker-compose.yml": ``` environment: - BASE_URL=https://subdomain.domain.com - TRUST_PROXY=1 ``` And I have this in my Apache conf (the RewriteCond in "location /" did make the trick) : ``` <VirtualHost *:80> ServerName subdomain.domain.com Redirect permanent / https://subdomain.domain.com/ RewriteEngine on RewriteCond %{SERVER_NAME} =subdomain.domain.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> <VirtualHost *:443> ServerName subdomain.domain.com Protocols h2 http/1.1 SSLEngine On <Directory /> Options -Indexes +FollowSymlinks AllowOverride None Require all granted </Directory> ProxyRequests On ProxyVia Full <Proxy *> Require all granted </Proxy> <Location /> ProxyPass http://MY.LOCAL.IP:3000/ ProxyPassReverse http://MY.LOCAL.IP:3000/ **RewriteEngine on RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC] RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC] RewriteRule /socket.io/(.*) ws://MY.LOCAL.IP:3000/socket.io/$1 [P]** </Location> </VirtualHost> ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#150