Hi I'm very confused right now if this is possible:
I'm using this plugin in conjunction with grunt-connect-proxy as middleware to proxy my local setup to work with a remote backend to go around same-origin error.
my local is setup on localhost:3007/html5storefront/
remote backend is at remote.server.com/subdirectory/
My problem is my request must be proxy to the subdirectory exactly. I can't go into my front-end to append this all over my code base, as the remote backend change from setup to setup, next one most likely will not have this subdirectory problem.
Below is the full grunt setup
connect: {
server: {
options: {
port: 3007,
hostname: 'localhost',
keepalive: true,
appendProxies: false,
// This middleware function ensures all requests go through the proxies
middleware: function(connect) {
var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;
return [proxySnippet];
}
},
proxies: [
{
// send backend request to remote server
host: 'remote.server.com/subdirectory/',
port: '80', // optional
context: '/cortex' // this value sends all request from this SF that starts with /cortex to host above
},
{
// this is my local served by nodejs on port 3008
context: '/',
host: 'localhost',
port: 3008,
// This rewrite allows the app to be accessed at:
// http://localhost:3007/ AND http://localhost:3007/html5storefront/
rewrite: {
'^/html5storefront/': '/'
}
}
]
}
}
Hi I'm very confused right now if this is possible:
I'm using this plugin in conjunction with
grunt-connect-proxy
as middleware to proxy my local setup to work with a remote backend to go around same-origin error.My problem is my request must be proxy to the subdirectory exactly. I can't go into my front-end to append this all over my code base, as the remote backend change from setup to setup, next one most likely will not have this subdirectory problem.
Below is the full grunt setup
Thanks a lot for help!
a.