1

I try to create a connect proxy by this article. Almost everything is the same in my code, but I need to call something across https protocol.

connect: {
  options: {
    port: 9000,
      hostname: '0.0.0.0',
      livereload: 35729
  },
  proxies: [{
    context: ['/foo/product', '/foo/somethingelse'],
    host: 'non-https-domain.com',
    changeOrigin: true
    rewrite: {
      '^/foo': ''
    }
  },{
    context: '/productImages',
    host: 'https-domain.com',
    https: true,
    port: 443,  // just trying
    changeOrigin: true,
    rewrite: {
      '^/productImages': ''
    }
  }],
    livereload: {
    // the same like the article
  }
}

The /product and the /somethingelse works well, but the /productImages not.

I need to call it like this:

localhost:9000/productImages/lot/of/directory/and/finally/a/file.jpg

and it should call the

https://https-domain.com/lot/of/directory/and/finally/a/file.jpg

the point is that without /productImages. But the replace never happened.

Thanks in advance for the help!

kree
  • 440
  • 1
  • 9
  • 26
  • 1
    is there an error? Are you using a self signed SSL cert? – mike Sep 23 '14 at 13:49
  • There is no error, only simple call a wrong url. I don't use Self-signed certificate. – kree Sep 23 '14 at 13:51
  • I'm not 100% positive but I believe you need a self signed cert for when trying to use https on localhost... where is it failing? – mike Sep 23 '14 at 13:55
  • It fails to https://https-domain.com/productImages/lot/of/directory/and/finally/a/file.jpg The server got the call, but with the `/productImages`. – kree Sep 23 '14 at 14:04
  • have you tried without https? – mike Sep 23 '14 at 19:50
  • I have to use https for that call. But the another proxy setting is an example for the non-https call. – kree Sep 23 '14 at 20:59

1 Answers1

2

I made a stupid mistake: There is only error with the names!

There is a /product proxy context for the product list, and a /productImages for the images. I use regex to set these names. And the "^/product" will replace the /productImages too. (I put the foo only for testing the rewrite)

kree
  • 440
  • 1
  • 9
  • 26