unit icon indicating copy to clipboard operation
unit copied to clipboard

Redmine uri bug?

Open amg-web opened this issue 3 years ago • 9 comments

I used nginx unit config for Redmine 5.0.1 with ruby 2.7.5 https://unit.nginx.org/howto/redmine/#redmine

But application add /config.ru/ to all uri

amg-web avatar Jun 21 '22 16:06 amg-web

Can you please share your Unit configuration as well as as the version of Unit you are using at the moment?

Cheers Timo

tippexs avatar Jun 21 '22 16:06 tippexs

@tippexs

{
	"listeners": {
		"*:80": {
			"pass": "routes"
		}
	},

	"routes": [
		{
			"action": {
				"share": "/home/redmine/public_html/public$uri",
				"fallback": {
					"pass": "applications/rails"
				}
			}
		}
	],

	"applications": {
		"rails": {
			"type": "ruby",
			"script": "config.ru",
			"working_directory": "/home/redmine/public_html/",
			"environment": {
				"RAILS_ENV": "production"
			}
		}
	}
}

version

unitd --version
unit version: 1.27.0
configured as ./configure --prefix=/usr --state=/var/lib/unit --control=unix:/var/run/control.unit.sock --pid=/var/run/unit.pid --log=/var/log/unit.log --tmp=/var/tmp --user=unit --group=unit --tests --openssl --modules=/usr/lib/unit/modules --libdir=/usr/lib/x86_64-linux-gnu --cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/unit-1.27.0/pkg/deb/debuild/unit-1.27.0=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --ld-opt='-Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

without "routes" same result

amg-web avatar Jun 21 '22 16:06 amg-web

Can you please try to set SCRIPT_NAME in your environment to "" like

"applications": {
		"rails": {
			"type": "ruby",
			"script": "config.ru",
			"working_directory": "/home/redmine/public_html/",
			"environment": {
				"RAILS_ENV": "production",
                                 "SCRIPT_NAME": ""
			}
		}
	}

We have a know bug at the moment and this one will be fixed in the next release.

tippexs avatar Jun 21 '22 16:06 tippexs

@tippexs same result also I have error in log error_unit.txt I use this ruby prebuilt packages https://launchpad.net/~brightbox/+archive/ubuntu/ruby-ng

amg-web avatar Jun 21 '22 16:06 amg-web

A downgrade of Unit to Version 1.26.1 should help in this case. As said - there was a change to the SCRIPT_NAME handling in Ruby introduced within 1.27. Working on a bug fix and will ship it with 1.28.

Let me know if that works for you.

tippexs avatar Jun 21 '22 17:06 tippexs

@tippexs Thanks. I do not need it urgent. I'll wait for fix. do you need more information for current config?

amg-web avatar Jun 21 '22 17:06 amg-web

No that is probably totally fine for now. We already know what the issue is. Will keep this issue open till 1.28 release. Thanks for reporting that to us! Cheers

tippexs avatar Jun 21 '22 17:06 tippexs

I applied a fix for a bug, that I think could fix your bug. Could you test building unit from source and check if you still have the bug?

Thanks!

alejandro-colomar avatar Jul 27 '22 11:07 alejandro-colomar

@amg-web what the difference when using unit

ashrafalzyoud avatar Jul 27 '22 18:07 ashrafalzyoud

Fixed with 1.28

Bugfix: force SCRIPT_NAME in Ruby to always be an empty string.

tippexs avatar Sep 16 '22 17:09 tippexs