Page MenuHomePhabricator

lighttpd redirects fail without a trailing slash
Closed, ResolvedPublic

Description

On the lighttpd web server in WMF labs, links fail if they don't contain a trailing slash. Compare:


Version: unspecified
Severity: normal

Details

Reference
bz59926

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:37 AM
bzimport added a project: Toolforge.
bzimport set Reference to bz59926.

For the record, links without trailing slashes are redirected to invalid (as seen from external world) host:

$ curl -v http://tools.wmflabs.org/matthewrbowker/cnrd

  • Hostname was NOT found in DNS cache
  • Adding handle: conn: 0x1144c10
  • Adding handle: send: 0
  • Adding handle: recv: 0
  • Curl_addHandleToPipeline: length: 1
  • - Conn 0 (0x1144c10) send_pipe: 1, recv_pipe: 0
  • Trying 208.80.153.201...
  • Connected to tools.wmflabs.org (208.80.153.201) port 80 (#0)

GET /matthewrbowker/cnrd HTTP/1.1
User-Agent: curl/7.34.0
Host: tools.wmflabs.org
Accept: */*

< HTTP/1.1 301 Moved Permanently
< Date: Sat, 08 Mar 2014 15:22:44 GMT

  • Server lighttpd/1.4.28 is not blacklisted

< Server: lighttpd/1.4.28
< Location: http://tools-webgrid-01:4058/matthewrbowker/cnrd/
< Content-Length: 0
<

  • Connection #0 to host tools.wmflabs.org left intact

This may appears to have been 'accidentally' fixed by turning ProxyPreserveHost On on the temporary apache proxies.

Appears to work for me. Thank you so much for fixing!

Reopening, behaviour seems to have reappeared following the change to a new proxy setup.

(In reply to Jarry1250 from comment #4)

Reopening, behaviour seems to have reappeared following the change to a new
proxy setup.

See bug 64058.

Unfortunately, this redirects from https to http, i. e.:

[tim@passepartout ~]$ lynx -mime_header -dump https://tools.wmflabs.org/matthewrbowker/cnrd
HTTP/1.1 301 Moved Permanently
Server: nginx/1.5.0
Date: Wed, 23 Apr 2014 15:28:21 GMT
Content-Length: 0
Connection: close
Location: http://tools.wmflabs.org/matthewrbowker/cnrd/
[tim@passepartout ~]$

So we'll need to teach lighttpd about https (or rewrite redirects in nginx?).

That is unrelated. The proxy provides an X-FORWARDED-PROTO header which can be used by the application to construct URIs if it really must redirect between protocols.

I filed bug #64627 for the https -> http issue.