Skip to content

remove remaining support for legacy IIS rewrite headers - #242

Open
falkenhawk wants to merge 2 commits into
masterfrom
remove-legacy-rewrite-headers
Open

falkenhawk wants to merge 2 commits into
masterfrom
remove-legacy-rewrite-headers

Conversation

@falkenhawk

@falkenhawk falkenhawk commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

followup to #197

#197 stopped Zend_Controller_Request_Http from trusting the X-Original-URL and X-Rewrite-URL headers (ZF2018-01).
Any client can send these headers, so trusting them lets a request change the URL the application sees.
That can bypass access rules of the web server or a proxy, and poison caches.

Four more places still trusted them:

  • Zend_Controller_Request_Apache404 - the same issue as in Zend_Controller_Request_Http: X-Rewrite-URL wins over REDIRECT_URL for routing
  • Zend_OpenId::selfUrl() - Zend_OpenId_Consumer compares the openid.return_to of a login response with it
  • Zend_Soap_AutoDiscover - the endpoint URL written into the generated WSDL
  • Zend_Feed_Pubsubhubbub_CallbackAbstract::_detectCallbackUrl() - not called by ZF1 itself, but available to subclasses. zend-feed removed the headers there as part of ZF2018-01 (laminas/laminas-feed@b28589c).

For example, with Zend_Controller_Request_Apache404 this request is routed to /admin:

GET /some-missing-page HTTP/1.1
X-Rewrite-URL: /admin

Backwards compatibility

The same as for #197: only setups relying on these IIS-specific headers are affected.
The URL now always comes from the server variables set by the web server.

Also fixed

  • the docblock of Zend_Controller_Request_Http::setRequestUri() still listed HTTP_X_REWRITE_URL
  • _detectCallbackUrl() and _getHttpHost() read $_SERVER['HTTPS'] without checking that it exists, which raises a warning on plain http

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant