Git Product home page Git Product logo

Comments (15)

SinoBoeckmann avatar SinoBoeckmann commented on September 26, 2024 1

With REQUIRE_HTTPS=true I'm getting a "too many redirects".

I'm not sure yet what is redirecting so often. I will have a look into this later!

from dockerfiles.

hillelcoren avatar hillelcoren commented on September 26, 2024 1

Maybe this will help:
https://www.invoiceninja.com/forums/topic/ssl-too-many-redirects/#post-8578

Also, you may need to configure the trusted proxies:
http://docs.invoiceninja.com/en/latest/configure.html#using-a-proxy

from dockerfiles.

lalop avatar lalop commented on September 26, 2024 1

hey @SinoBoeckmann maybe you should add your proxy as a trusted one https://github.com/invoiceninja/invoiceninja/blob/master/.env.example#L36

from dockerfiles.

SinoBoeckmann avatar SinoBoeckmann commented on September 26, 2024 1

@Mzngit This is just a "normal" nginx/ "vhost" configuration:
Here is in full grace:

# 1. force the website to be https
server {
	listen 80;
	listen [::]:80;

	server_name domain.name;
	return 301 https://domain.name$uri$is_args$args;
}

# 2. the actual config with the proxy
server {

	listen 443 ssl;
	listen [::]:443 ssl;

	ssl_certificate /etc/letsencrypt/live/domain.name/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/domain.name/privkey.pem;

	server_name domain.name;

	location / {
		proxy_set_header        Host $host;
		proxy_set_header        X-Real-IP $remote_addr;
		proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header        X-Forwarded-Proto $scheme;

		# Fix the β€œIt appears that your reverse proxy set up is broken" error.
		proxy_pass		http://127.0.0.1:8858;
		proxy_read_timeout	90;
		#proxy_redirect		http://localhost:8858 https://domain.name;
	}
}

Within this config it is working well.
But there are some other issues with this docker repo here and the Dockerfile!

I will open a pull request later this week with some fixes to the system. :)

from dockerfiles.

hillelcoren avatar hillelcoren commented on September 26, 2024

The APP_URL value is only used in cases where the site is accessed without a browser. ie, when running artisan console commands.

from dockerfiles.

SinoBoeckmann avatar SinoBoeckmann commented on September 26, 2024

Okay!
And why is the URL then "hardcoded/ hardlinked" in the markup and not just relative to the domain?

Is there a way to change this? Or at least to change it once to another domain name?

from dockerfiles.

hillelcoren avatar hillelcoren commented on September 26, 2024

Sorry, I'm not sure how to change this. It's probably related to using a proxy.

from dockerfiles.

SinoBoeckmann avatar SinoBoeckmann commented on September 26, 2024

So... I got it. Somehow.
I needed to add the following lines to my proxy_pass in nginx (host)

proxy_redirect off; proxy_set_header Host $Host

But then I had the problem, that internally in laraval/ symfony the asset-method still get me http links instead of https so unfortunately I needed to change the routes/web.php and add

if (env('APP_ENV') === 'production') { URL::forceSchema('https'); }

on top of this file.
(https://laracasts.com/discuss/channels/laravel/how-i-can-force-all-my-routes-to-be-https-not-http?page=1)

Maybe, it is possible to add this URL::forceSchema('https'); to the repo of invoiceninja if the checkbox (use ssl/tls) is checked in the invoiceninja setup progress!

from dockerfiles.

hillelcoren avatar hillelcoren commented on September 26, 2024

Thanks for sharing the solution!

You can add REQUIRE_HTTPS=true to the .env file to require HTTPS

from dockerfiles.

SinoBoeckmann avatar SinoBoeckmann commented on September 26, 2024

@hillelcoren
It is this file:44 that causes the redirects... but I'm not sure why and nor I'm that into Symfony/ Laravel to know where Redirect::secure is come form.

https://github.com/invoiceninja/invoiceninja/blob/3cbf29afad95585e9642775d3d1244460e024a9c/app/Http/Middleware/StartupCheck.php

from dockerfiles.

SinoBoeckmann avatar SinoBoeckmann commented on September 26, 2024

I will have a look into that urls... but beside that. Even when I remove this trigger the internal links are not delivered as https as like URL::forceSchema('https'); does!

from dockerfiles.

hillelcoren avatar hillelcoren commented on September 26, 2024

Yes, that's the relevant code.

Not sure...

from dockerfiles.

Mzngit avatar Mzngit commented on September 26, 2024

@SinoBoeckmann For those of us who are newbies, where in the nginx.conf file is your line (prox redirect) line get added?
Also, do you think it has any relevance to the problem in issue #62 relating to Upgrade?
Thanks.

from dockerfiles.

SinoBoeckmann avatar SinoBoeckmann commented on September 26, 2024

Ah ... and @lalop. I tried the trusted proxy config as you mentioned. But this wasn't working either.
There is something in this case that I'm missing and I will figure it out! :)

from dockerfiles.

lalop avatar lalop commented on September 26, 2024

@SinoBoeckmann did you find any explanation ?

from dockerfiles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.