linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

apiProxy not working as expected #306

Closed sdeering closed 9 years ago

sdeering commented 9 years ago

Hi guys, I've read through a similar issue https://github.com/linemanjs/lineman/issues/257 but still stuck on getting my apiProxy to work on my local machine. I have a back-end running on virtual host http://local.laravel.com and my lineman dev running on localhost:9000 as per usual. Is there a way to tell Lineman I want it to use a real back-end for specific routes? Am I missing something here?

    server: {
      pushState: true,
      // API Proxying
      //
      // During development, you'll likely want to make XHR (AJAX) requests to an API on the same
      // port as your lineman development server. By enabling the API proxy and setting the port, all
      // requests for paths that don't match a static asset in ./generated will be forwarded to
      // whatever service might be running on the specified port.
      //
      apiProxy: {
        enabled: true,
        host: 'http://local.laravel.com',
        changeOrigin: true,
        port: '80',
        prefix: 'api'
      },

      web: {
        port: 9000
      }
    },
searls commented 9 years ago

There's not a lot we can do to debug this. What error are you seeing?

On Mon, Aug 4, 2014 at 4:27 AM, Sam Deering notifications@github.com wrote:

Hi guys, I've read through a similar issue #257 https://github.com/linemanjs/lineman/issues/257 but still stuck on getting my apiProxy to work on my local machine. I have a back-end running on virtual host http://local.laravel.com and my lineman dev running on localhost:9000 as per usual. Am I missing something here?

server: {
  pushState: true,
  // API Proxying
  //
  // During development, you'll likely want to make XHR (AJAX) requests to an API on the same
  // port as your lineman development server. By enabling the API proxy and setting the port, all
  // requests for paths that don't match a static asset in ./generated will be forwarded to
  // whatever service might be running on the specified port.
  //
  apiProxy: {
    enabled: true,
    host: 'http://local.laravel.com',
    changeOrigin: true,
    port: '80',
    prefix: 'api'
  },

  web: {
    port: 9000
  }
},

Reply to this email directly or view it on GitHub https://github.com/linemanjs/lineman/issues/306.

sdeering commented 9 years ago

Hi Justin, not an error as such just I expected apiProxy to allow changing the host of the back-end so I can switch to my real back-end while still developing with Lineman on port 9000. Is there a way around this? How do you do it?

searls commented 9 years ago

I don't understand what you're saying, can you communicate a route you're hitting, what you expect to happen, and what actually happens?

On Mon, Aug 4, 2014 at 8:35 PM, Sam Deering notifications@github.com wrote:

Hi Justin, not an error as such just I expected apiProxy to allow changing the host of the back-end so I can switch to my real back-end while still developing with Lineman on port 9000.

Reply to this email directly or view it on GitHub: https://github.com/linemanjs/lineman/issues/306#issuecomment-51136330

sdeering commented 9 years ago

I downloaded newest version of lineman-angular template (which uses lineman ">= 0.28.0"). The apiProxy is working as expected. My project is using lineman 0.23.0 so I will update and hopefully should work.