2

i am implementing the currency switcher on my 1.5.1.0 CE site. it's a fairly straightforward implementation, but for some reason, once i select a currency, i get redirected to the homepage rather than the page i was one.

i narrowed it down to the fact that the method _isUrlInternal is failing due to the port number being in the referring url. i'm definitely not using port numbers explicitly (using the standard 80/443).

can anyone think of a reason why it would be evaluating port numbers?

9
  • 1
    Are you using a reverse proxy. Ie. Varnish/Nginx before PHP/Apache? It might be worth doing var_dump($_SERVER); to confirm the values of HTTP_HOST and REMOTE_ADDR Commented May 21, 2013 at 21:44
  • nope, just a standard apache config. neither HTTP_HOST or REMOTE_ADDR have the port listed.
    – Laura
    Commented May 22, 2013 at 14:58
  • Then if its not there, I would guess someone has changed core code. All I could suggest is greping the code and lib dirs for the existence of the post being defined. Commented May 22, 2013 at 15:06
  • 1
    i think it's coming from getCurrentUrl() in the core helper: $port = $request->getServer('SERVER_PORT'); if ($port) { if ($port == Mage_Core_Controller_Request_Http::DEFAULT_HTTP_PORT) { $port = ''; } else { $port = ':' . $port; } } since i'm on SSL when i'm on the cart :\
    – Laura
    Commented May 22, 2013 at 15:22
  • Can you test in a non-port enviro for DDx?
    – benmarks
    Commented May 24, 2013 at 1:02

1 Answer 1

1

for some reason, magento doesn't seem to include 443 as a default port (or doesn't check for it).

getCurrentUrl() in the core helper:

$port = $request->getServer('SERVER_PORT');
if ($port) {
  if ($port == Mage_Core_Controller_Request_Http::DEFAULT_HTTP_PORT) {
    $port = '';
  }
  else {
    $port = ':' . $port;
  }
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.