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

SSL termination conflict with file attachment URL #3815

Closed
st5000 opened this issue Jan 9, 2020 · 4 comments
Closed

SSL termination conflict with file attachment URL #3815

st5000 opened this issue Jan 9, 2020 · 4 comments

Comments

@st5000
Copy link

st5000 commented Jan 9, 2020

When using SSL termination (outside of HH instance which runs in clear http) all file attachment URL ("/file/file/download?guid=...") are always sent in http while client connection is forced https (also specified in Settings -> General -> Base URL)

This situation triggers "Connection Is Not Secure" alerts at client side an cause some strange behavior on some browsers.

@luke-
Copy link
Contributor

luke- commented Jan 22, 2020

You need to specify a the SSL proxy server as trusted host:
https://www.yiiframework.com/doc/api/2.0/yii-web-request#$trustedHosts-detail

e.g. protected/config/web.php
(You should replace any with the ip of the server.)

return [
    'components' => [
        'request' => [
            'trustedHosts' => ['any']
        ]

    ]
];

Or you can add following before the return:
$_SERVER['HTTPS'] = 'on';

@st5000
Copy link
Author

st5000 commented Jan 23, 2020

Added trustedHosts field and it works normally.

Thanks for the tip ! 👍

@st5000 st5000 closed this as completed Feb 2, 2020
@luke- luke- reopened this Feb 2, 2020
@luke-
Copy link
Contributor

luke- commented Feb 2, 2020

We should leave this open, to enhance the documention...

@luke-
Copy link
Contributor

luke- commented Apr 3, 2020

@luke- luke- closed this as completed Apr 3, 2020
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

3 participants