You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The use case we are trying to solve is running spandx in an OpenShift Pod as one container together with another container serving part of the content. When running in a pod, it is exposed via an OpenShift Service, and ultimately outside of the cluster through an OpenShift Route. The Route defines what the link rewriting values should be as seen by the end user, but spandx needs to do it's listening with different values. An illustration can show this best
route: route_outside_my_cluster.example.com:443 (will route to service_inside_my_cluster:1337)
service: service_inside_my_cluster:1337 (will forward to pod:1337)
pod:
container1: spandx:1337 (will listen on 1337, proxy /my_app to localhost:8002, and / to static.example.com)
container2: partial_application:8002
From the outside I need links to be rewritten to route_outside_my_cluster.example.com:443, as that's what the end user will see, but the link rewriting use the same port value that spandx will listen on. What I end up with are the links rewritten to route_outside_my_cluster.example.com:1337. If possible, I would like the spandx config to have a way to give the rewriting rules different values.
Example config and output:
### USING SPANDX CONFIG ###
{ host: 'route_outside_my_cluster.example.com',
port: 1337,
routes:
{ '/static': { host: 'https://static.example.com' },
'/my_app': { host: 'https://localhost:8002' },
'/': { host: 'https://static.example.com' } } }
###########################
For more info see: https://github.com/redhataccess/spandx
configuration: /spandx.config.js
Launching spandx with the following configuration
These paths will be routed to the following remote hosts
https://route_outside_my_cluster.example.com:1337 /static will be routed to https://static.example.com /static
https://route_outside_my_cluster.example.com:1337 /my_app will be routed to https://localhost:8002 /my_app
https://route_outside_my_cluster.example.com:1337 / will be routed to https://static.example.com /
These paths will be routed to your local filesystem
Your browser will refresh when files change under these paths
These find/replace rules will be used to fix links in remote server responses
/https:\/\/static.example.com/g will be replaced with "https://route_outside_my_cluster.example.com:1337 "
/https:\/\/localhost:8002/g will be replaced with "https://route_outside_my_cluster.example.com:1337 "
/https:\/\/static.example.com/g will be replaced with "https://route_outside_my_cluster.example.com:1337 "
spandx URL:
https://route_outside_my_cluster.example.com:1337/
[Browsersync] Proxying: http://localhost:8000
[Browsersync] Access URLs:
------------------------------
Local: https://localhost:1337/
------------------------------
If I change the config's port value from 1337 to 443 to satisfy the link rewriting, then spandx will listen on 443 as well, but in an OpenShift Pod that is not allowed without requiring elevated privileges. If there were a way to separately specify spandx's listening port, then I could set the link rewriting to 443 and the listening port to 1337.
Generalized, I think this would happen with any proxy/load-balancer in front of spandx.
maybe? I wasn't sure if the existing "port" should be tied to the spandx listening side or the externally facing side. But once one side is chosen (as in your example you chose it to be the spandx listening side), then a second port config for the other side seems like a decent approach.
The use case we are trying to solve is running spandx in an OpenShift Pod as one container together with another container serving part of the content. When running in a pod, it is exposed via an OpenShift Service, and ultimately outside of the cluster through an OpenShift Route. The Route defines what the link rewriting values should be as seen by the end user, but spandx needs to do it's listening with different values. An illustration can show this best
route_outside_my_cluster.example.com:443
(will route toservice_inside_my_cluster:1337
)service_inside_my_cluster:1337
(will forward topod:1337
)spandx:1337
(will listen on1337
, proxy/my_app
tolocalhost:8002
, and/
tostatic.example.com
)partial_application:8002
From the outside I need links to be rewritten to
route_outside_my_cluster.example.com:443
, as that's what the end user will see, but the link rewriting use the same port value that spandx will listen on. What I end up with are the links rewritten toroute_outside_my_cluster.example.com:1337
. If possible, I would like the spandx config to have a way to give the rewriting rules different values.Example config and output:
If I change the config's port value from 1337 to 443 to satisfy the link rewriting, then spandx will listen on 443 as well, but in an OpenShift Pod that is not allowed without requiring elevated privileges. If there were a way to separately specify spandx's listening port, then I could set the link rewriting to 443 and the listening port to 1337.
Generalized, I think this would happen with any proxy/load-balancer in front of spandx.
cc @iphands @carbonin
The text was updated successfully, but these errors were encountered: