Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example usage #1

Open
juanmf opened this issue Feb 23, 2016 · 3 comments
Open

Example usage #1

juanmf opened this issue Feb 23, 2016 · 3 comments

Comments

@juanmf
Copy link

juanmf commented Feb 23, 2016

Hi,

I find myself making reverse engineering due to the lack of a friendly usage example.

Thanks!

@juanmf
Copy link
Author

juanmf commented Feb 24, 2016

for now I can leave my changes to the app configs in order to make it work. Still I have an error in version 1.0 that seems solved in dev-master (didn't try it yet)

$ git diff app/AppKernel.php app/config/config.yml app/config/routing.yml composer.json 
diff --git a/app/AppKernel.php b/app/AppKernel.php
index 8695ef2..d2031e6 100755
--- a/app/AppKernel.php
+++ b/app/AppKernel.php
@@ -30,7 +30,8 @@ class AppKernel extends Kernel
             new DocDigital\Bundle\CdnBundle\DdCdnBundle(),
             new DocDigital\Bundle\PdfBundle\DdPdfBundle(),
+            new Bangpound\Bundle\GuzzleProxyBundle\BangpoundGuzzleProxyBundle(),
         );

         if (in_array($this->getEnvironment(), array('dev', 'test'))) {
diff --git a/app/config/config.yml b/app/config/config.yml
index 888aedc..2f6e28c 100755
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -183,3 +183,10 @@ knp_snappy:
 services:
     fos_user.doctrine_registry:
         alias: doctrine
+        
+bangpound_guzzle_proxy:
+    endpoints:
+        ide_chaco_ows: 
+            base_url: http://google.com.ar
+    
+    
diff --git a/app/config/routing.yml b/app/config/routing.yml
index 417262e..f108f26 100755
--- a/app/config/routing.yml
+++ b/app/config/routing.yml
@@ -3,6 +3,7 @@ application_colonizacion:
     type:     annotation
     prefix:   /

+
 application_inventario:
     resource: "@ApplicationInventarioBundle/Controller/"
     type:     annotation
@@ -56,3 +57,7 @@ homepage:
 #    resource: "@OkulbilisimFeedbackBundle/Resources/config/routing.yml"
 #    prefix:   /

+application_proxy:
+    resource: ide_chaco_ows
+    type:     guzzle_proxy
+    prefix:   /proxied
diff --git a/composer.json b/composer.json
index 69853ed..f37b4a9 100755
--- a/composer.json
+++ b/composer.json
@@ -30,7 +30,8 @@
         "itbz/fpdf": "1.7.2",
         "itbz/fpdi": "1.5.2",
         "kriswallsmith/buzz": "^0.15.0",
+        "bangpound/guzzle-proxy-bundle": "dev-master"        
+        
     },
     "scripts": {
         "post-install-cmd": [

@juanmf
Copy link
Author

juanmf commented Feb 24, 2016

dev master is not installable:

$ composer require bangpound/guzzle-proxy-bundle:dev-master
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for bangpound/guzzle-proxy-bundle dev-master -> satisfiable by bangpound/guzzle-proxy-bundle[dev-master].
    - Conclusion: remove guzzlehttp/guzzle 5.3.0
    - Can only install one of: guzzlehttp/guzzle[6.1.0, 5.3.0].
    - Can only install one of: guzzlehttp/guzzle[6.1.0, 5.3.0].
    - bangpound/guzzle-proxy-bundle dev-master requires guzzlehttp/guzzle ~6.1 -> satisfiable by guzzlehttp/guzzle[6.1.0, 6.1.1].
    - Conclusion: don't install guzzlehttp/guzzle 6.1.1
    - Installation request for guzzlehttp/guzzle == 5.3.0.0 -> satisfiable by guzzlehttp/guzzle[5.3.0].

@juanmf
Copy link
Author

juanmf commented Feb 24, 2016

Fixed in v1.0 at the Listener. removing header Transfer-Encoding
at dev-master it is intended in the ProxyController

class ResponseListener
{
    /**
     * @param GetResponseForControllerResultEvent $event
     */
    public function onKernelView(GetResponseForControllerResultEvent $event)
    {
        $result = $event->getControllerResult();

        if ($result instanceof ResponseInterface) {
            if ($result->hasHeader('Transfer-Encoding')) {
                $result->removeHeader('Transfer-Encoding');
            }
            $event->setResponse(new Response((string) $result->getBody(), $result->getStatusCode(), $result->getHeaders()));
        }
    }
}

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

No branches or pull requests

1 participant