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

HTTPS behind reverse proxy #14

Closed
AlexClineBB opened this issue Jan 6, 2017 · 2 comments
Closed

HTTPS behind reverse proxy #14

AlexClineBB opened this issue Jan 6, 2017 · 2 comments

Comments

@AlexClineBB
Copy link

AlexClineBB commented Jan 6, 2017

We've deployed FirePhish with a load balancer in front of it. Due to the way Laravel generates asset URLs, requests to https://firephish.example.com would attempt to load assets from http://firephish.example.com. To fix this issue, I updated the app/Http/routes.php file to have the following at the top:

$proxy_url    = getenv('PROXY_URL');
$proxy_schema = getenv('PROXY_SCHEMA');

if (!empty($proxy_url)) {
   URL::forceRootUrl($proxy_url);
}

if (!empty($proxy_schema)) {
   URL::forceSchema($proxy_schema);
}

And added the following to the .env file:

PROXY_URL = http://firephish.example.com/
PROXY_SCHEMA = https

I'm not familiar enough with Laravel to submit a PR to patch this in a more permanent way, but I figured I'd document it for others who use this configuration.

@Raikia
Copy link
Owner

Raikia commented Jan 7, 2017

Interesting, I'll take a look into proper implementation of this.

To add to your changes, you may have some problems if you change other configurations via "Settings" --> "Configurations" since it will cache the .env file. Due to the way laravel works, I suggest you add the following to "/config/firephish.php":

'PROXY_URL' => env('PROXY_URL', null),
'PROXY_SCHEMA' => env('PROXY_SCHEMA', null)

Then run php artisan config:cache

Then instead of you using "getenv", use "config('firephish.PROXY_URL')" and "config('firephish.PROXY_SCHEMA')".

But as I said, I will add this as a proper implementation soon.

Note: FirePhish recently changed name to FiercePhish. This also means all references to firephish have been updated to fiercephish, so if you are using the latest version, look for fiercephish instead of firephish

@Raikia
Copy link
Owner

Raikia commented Jan 7, 2017

You can see I ran into the problem of using env() vs config() as well on commit e6c4579 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants