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

http to https in html #378

Open
C0pywriting opened this issue Jul 5, 2022 · 8 comments
Open

http to https in html #378

C0pywriting opened this issue Jul 5, 2022 · 8 comments

Comments

@C0pywriting
Copy link

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

image

image

image

@vaughngx4
Copy link
Contributor

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

@C0pywriting
Copy link
Author

C0pywriting commented Jul 6, 2022

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=

@vaughngx4
Copy link
Contributor

vaughngx4 commented Jul 6, 2022

@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

@C0pywriting
Copy link
Author

@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

@vaughngx4
Copy link
Contributor

vaughngx4 commented Jul 6, 2022

@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
Copy link
Contributor

vaughngx4 commented Jul 9, 2022

@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
Copy link
Contributor

@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 }

@xdubx
Copy link

xdubx commented Nov 27, 2022

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.

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

3 participants