snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Trusted Proxy not working after update to v3 - Mixed Content errors

Open drcryo opened this issue 10 years ago • 16 comments

Let me first thank you guys for such a great piece of software, you made here. I very appreciate it and I'm working with it on daily basis.

But let's speak about that error I have. After successful upgrade to v3 (hour ago) from master branch, everything looks perfect until I've tried to access my instance through the reverse proxy. And Mixed Content problem is back.

Web is trying to access some static content thru http://, which ends with error, because our proxy denies it. I'm using HAproxy with unchanged setting, perfectly working with previous version (v2.1), so it sends correct HTTP Headers. I put correct IP address in my .env value. Even asterisk there is not helping.

Unfortunately there's no error in Apache logs, because connection is refused at HAproxy interface. I've tried changing APP_URL string, but no luck with that.

I would be glad for any guidance and thank you for it in advance. Also pardon me for my basic English.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

drcryo avatar Jul 21 '16 19:07 drcryo

We have our instance setup with a reverse proxy as well (Version 3).

We had the same issue until we forwarded to port 443 to the internal site and setup a self signed cert on the internal web server running Snipe-IT.

stevecookms avatar Jul 21 '16 19:07 stevecookms

@Steve, this should work, but just as temporary solution. It doubles SSL computing load and gets directly against meaning of Trusted Proxies module. Nevertheless thank you for your suggestion.

drcryo avatar Jul 21 '16 20:07 drcryo

I totally agree.

stevecookms avatar Jul 21 '16 20:07 stevecookms

Even with the correct 'APP_TRUSTED_PROXIES' we are also having this issue.

Edit: I should note we are using the official docker image and I have confirmed with phpinfo that we have the correct IP in TRUSTED_PROXIES and the correct X-Forwarded-Proto headers are being passed to the Snipe Apache server

timwsuqld avatar Aug 11 '16 00:08 timwsuqld

Maybe https://github.com/fideloper/TrustedProxy/issues/50 is related?

timwsuqld avatar Aug 11 '16 00:08 timwsuqld

I'm in the same boat. I am new to snipeit, and am also setting up using official docker image, but cannot use it with my Apache server acting as the proxy, letting my Apache server handle SSL to the outside world. APP_TRUSTED_PROXIES is set correctly. Everything works fine if I don't use a proxy.

I have tried setting all of the following without luck in Apache: Header always set Content-Security-Policy: upgrade-insecure-requests Header always set Access-Control-Allow-Origin "*" Header always set Access-Control-Allow-Credentials true Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT" Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token" RequestHeader set X-Forwarded-Proto "https"

upgrade-insecure-requests at least gets most of the assets working, even though they are directed to http instead of the expected https, but accessing anything at /api, /reports, etc... all return 401 (Unauthorized)/Response for preflight has invalid HTTP status code 401.

gui81 avatar Nov 16 '16 05:11 gui81

I'm having the same issues, and despite the documentation about reverse proxying and docker APP_URL setup correctly, SnipeIT is the only service we're using that doesn't allow HTTPS to HTTP reverse proxying... Has anyone managed to bypass this limitation?

jstoja avatar Aug 28 '17 13:08 jstoja

ditto^. Using Apache reverse proxy -- following reverse proxy documentation on APP_TRUSTED_PROXIES and x forwarded proto https -- still no luck -- just a mixed content/unsafe script login page. snipe-it server works fine w/o reverse proxy, and the reverse proxy is configured correctly (for other sites that don't have mixed content issues). APP_URL is set to the reverse proxy URL. Using SnipeIT Version v3.6.6 build 1 / Apache 2.4.6. / Installed from GIT.

config is HTTPS reverse proxy -> HTTP snipe-IT

edit: used the workaround here to get it working https://github.com/snipe/snipe-it/issues/3495

mnash04 avatar Aug 30 '17 17:08 mnash04

@mnash04 You mean by using the env var APP_TRUSTED_PROXIES ?

jstoja avatar Sep 12 '17 13:09 jstoja

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

stale[bot] avatar Jan 20 '18 08:01 stale[bot]

Nope, this is still happening.

jstoja avatar Jan 22 '18 08:01 jstoja

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

stale[bot] avatar May 05 '18 06:05 stale[bot]

@jstoja Are you still having issues with this?

timwsuqld avatar May 07 '18 21:05 timwsuqld

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

stale[bot] avatar Jul 06 '18 22:07 stale[bot]

they @timwsuqld I don't know, to be honest I'm not using snipe-it anymore. You can probably try to reproduce it with this setup: config is HTTPS reverse proxy -> HTTP snipe-IT.

jstoja avatar Jul 12 '18 20:07 jstoja

We've released many new versions since this ticket was opened, including some changes to the proxy setup, so I'm going to close this for now. If its still a problem in 4.5, please open a new ticket.

snipe avatar Jul 12 '18 21:07 snipe