nginx位置不能同时具有重写和代理

时间:2018-04-13 11:22:47

标签: nginx

location = / land {

public function buyAction()
  {
        $sksku = $_REQUEST['skusky'];
        $_sku = "sample-".$sksku;

$id = Mage::getModel('catalog/product')->getIdBySku($_sku);
if ($id){
        $_catalog = Mage::getModel('catalog/product');
        $_productId = $_catalog->getIdBySku($_sku);
        $_product = Mage::getModel('catalog/product')->load($_productId);
        $id = $_product->getEntityId();
        $form_key = Mage::getSingleton('core/session')->getFormKey();
        $params = array('form_key'=>$form_key,'qty'=>1);
        $product = Mage::getModel('catalog/product')
        ->setStoreId(
        Mage::app()
        ->getStore()
        ->getId()
        )
        ->load($id);
        $cart = Mage::helper('checkout/cart')->getCart();
        $cart->addProduct($product, $params);
        $cart->save();

        $this->_redirect('checkout/cart');
        Mage::getSingleton('core/session')->addSuccess('Your product has been added to cart.');
}
else{
        $this->_redirectReferer();
        Mage::getSingleton('core/session')->addError('Sorry!!! No sample color option available for this product.');
}      
  }

}

打扰一下,上面的问题在哪里? 我应该如何修改它?

THKS〜

1 个答案:

答案 0 :(得分:0)

将代理内容和静态内容分开是明智的:

location = /land {    
  if ($http_user_agent ~* "(Android|iPhone|iPod|Symbian|BlackBerry|Windows Phone|Mobile|J2ME)") {
    rewrite ^ /index.html last;
  }
  proxy_pass http://172.0.0.78:3033;
}

location = /index.html {
  root /home/xxx/;
}