I have a Web Application running in HTTP. However I wanted to test a Web Service that is running on HTTPS using CORS. Since HTTP won't allow HTTPS request, I wanted to setup a proxy in my Web Application so that it appears as HTTPS. How can I achieve this redirection in Linux?
2 Answers
I've found devd
from https://github.com/cortesi/devd to be quite helpful for this type of debugging/development. This is an utility that can act as a local webserver as well as a reverse proxy, and it's the latter functionality that will be especially useful in this case.
It also conveniently has a --crossdomain
option for setting the CORS header Access-Control-Allowed: *
E.g redirecting HTTPS requests on port 443 to HTTP server on localhost port 8080:
# devd --tls --port 443 http://localhost:8080
(it will autogenerate self-signed cert and save it to ~/.devd.cert, if it doesn't already exist)

- 694
The normal was is to set up a reverse proxy between your application and the rest of the network. The proxy terminates the SSL connection, and makes an unencrypted connection to the backend.
Popular choices include HAProxy, Nginx, and Apache (mod_proxy). For example, Stack Exchange uses HAProxy to terminate TLS/SSL.

- 109,670