Socioboard-5.0 icon indicating copy to clipboard operation
Socioboard-5.0 copied to clipboard

http to https in html

Open C0pywriting opened this issue 2 years ago • 8 comments

Where did I make a wrong turn that in the code of the website http is deposited. can mann change that?

image

image

image

C0pywriting avatar Jul 05 '22 13:07 C0pywriting

Have you tried changing the URL scheme in socioboard-web-php/.env?

vaughngx4 avatar Jul 06 '22 03:07 vaughngx4

Hi and thanks for your reply, this is my current .env with https:// or am I misunderstanding something here

root@xx:~# cd /var/www/socioboard/socioboard-web-php/
root@xx:/var/www/socioboard/socioboard-web-php# cat .env 
APP_NAME=SocioBoard
APP_ENV=production
APP_KEY=base64:xxx
APP_DEBUG=true

# All these should end with /
APP_URL=https://socio.xxxxx.de/
WEBSITE_TITLE="xxx"
#API_URL=<<USER NODE SERIVE>>
#API_URL_FEEDS=<<FEEDS NODE SERIVE>>
#API_URL_PUBLISH=<<PUBLISH NODE SERVICE>>
#API_URL_UPDATE=<<UPDATE NODE SERVICE>>

# Example to the services
# APP_URL=https://local.socioboard.com/
# WEBSITE_TITLE="SocioBoard5.0"
API_URL= http://localhost:3000/
API_URL_FEEDS=http://localhost:3001/
API_URL_PUBLISH=http://localhost:3002/
API_URL_UPDATE=http://localhost:3003/
API_URL_NOTIFICATION=http://localhost:3004/


API_VERSION=v1

LOG_CHANNEL=stack
LOG_LEVEL=debug

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120


YOUTUBE_TRENDS_KEYWORD=
TWITTER_TRENDS_KEYWORD=
RSS_TRENDS_KEYWORD=

C0pywriting avatar Jul 06 '22 14:07 C0pywriting

@C0pywriting I see you have the api on localhost, is that intentional? Also, what reverse proxy are you using?

Edit: I will look into it and get back to you

vaughngx4 avatar Jul 06 '22 16:07 vaughngx4

@vaughngx4

I use ha Proxy api and everything else works only the http unfortunately does not let the page load from external

is there anything else that needs to be done for the .env to take effect?

composer update and apache restart are done

C0pywriting avatar Jul 06 '22 16:07 C0pywriting

@C0pywriting aside from restarting the frontend, nothing that I know of. I'll try to replicate the issue and get back to you soon.

vaughngx4 avatar Jul 06 '22 16:07 vaughngx4

@C0pywriting I've found the issue. The frontend is basically built to write paths the way it is given. So when using a proxy it gives the URI we gave to the proxy as an upstream. It's an easy fix but I can't test right now. I've added nginx to the docker stack, will update later to make proxying easier.

Example: In nginx I proxied the frontend(https://socioboard.mydomain.example) to the container(http://socioboard:8000) and the resources were attempting to load from the http://socioboard:8000 URI.

Edit: This should fix it on nginx, but I haven't tested.

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Will look up haproxy when I have time.

vaughngx4 avatar Jul 09 '22 13:07 vaughngx4

@C0pywriting Here is a sample for haproxy:

option forwardfor
http-request set-header Host socioboard.mydomain.example if { srv_id 1 }
http-request set-header Host socioboard-api.mydomain.example if { srv_id 2 }

vaughngx4 avatar Jul 10 '22 07:07 vaughngx4

Hi i add to my reverse proxy the setting X_FORWARDED_PROTO. And add the following lines to app/socioboard-web-php/server.php

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
    $_SERVER['HTTPS'] = 'on';
}

And the error is gone.

xdubx avatar Nov 27 '22 11:11 xdubx