Skip to content

Http -> Https redirects when path is specified redirrect incorrectly #262

@clarkbains

Description

@clarkbains

If I have a route where pihole.mydomain.com proxies to 192.168.2.45/admin, with ssl enabled, and I try to hit http://pihole.mydomain.com, it will send back a 302 to https://pihole.mydomain.com/admin. My browser then follows this, which goes back through the reverse proxy, and ends up hitting my pihole at 192.168.2.45/admin/admin. This results in an error, since the admin interface is at 192.16 8.2.45/admin.

I expect that when the redirect happens, it should be using the path from the original request, not from the proxied request.

Redirect specified is redbird.register("pihole.xxxxxxxxx.com", "192.168.2.45", {ssl:true});
redbird was started with

new require('redbird')({
		port: 80,
		secure: true,
		ssl: [
			{
				port: 443,
				key: 'xxxxxxx',
				cert: 'xxxxxxx',
			}
		]
	})

Here is the output of curl. I'm using the Host header hack since I don't have dns pointing at my development server

curl 'http://pihole.xxxxxxxxx.com/index.php?login' -vvv
*   Trying 192.168.2.46:80...
* Connected to pihole.xxxxxxxxx.com (192.168.2.46) port 80 (#0)
> GET /index.php?login HTTP/1.1
> Host: pihole.xxxxxxxxx.com
> User-Agent: curl/7.71.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Location: https://pihole.xxxxxxxxx.com/admin/index.php?login
< Date: Sat, 22 Aug 2020 00:03:11 GMT
< Connection: keep-alive
< Transfer-Encoding: chunked
< 
* Connection #0 to host pihole.xxxxxxxxx.com left intact

When that request is made, it will go through redbird again and try and hit my pihole with the path http://192.168.2.45/admin/admin/index.php?login, and it should instead be http://192.168.2.45/admin/index.php?login

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions