Spring Boot with embedded Tomcat behind Apache proxy

I had the same problem the other day. After some debugging of Spring Boot 1.3 I found the following solution. 1. You have to setup the headers on your Apache proxy: <VirtualHost *:443> ServerName www.myapp.org ProxyPass / http://127.0.0.1:8080/ RequestHeader set X-Forwarded-Proto https RequestHeader set X-Forwarded-Port 443 ProxyPreserveHost On … (SSL directives omitted for readability) </VirtualHost> … Read more

What’s the de facto standard for a Reverse Proxy to tell the backend SSL is used?

The proxy can add extra (or overwrite) headers to requests it receives and passes through to the back-end. These can be used to communicate information to the back-end. So far I’ve seen a couple used for forcing the use of https in URL scheme: X-Forwarded-Protocol: https X-Forwarded-Ssl: on X-Url-Scheme: https And wikipedia also mentions: # … Read more

nginx proxy pass Node, SSL?

If you’re using nginx to handle SSL, then your node server will just be using http. upstream nodejs { server 127.0.0.1:4545 max_fails=0; } server { listen 443; ssl on; ssl_certificate newlocalhost.crt; ssl_certificate_key newlocalhost.key; server_name nodejs.newlocalhost.com; add_header Strict-Transport-Security max-age=500; location / { proxy_pass http://nodejs; proxy_redirect off; proxy_set_header Host $host ; proxy_set_header X-Real-IP $remote_addr ; proxy_set_header X-Forwarded-For … Read more

How to serve all existing static files directly with NGINX, but proxy the rest to a backend server.

Use try_files and named location block (‘@apachesite’). This will remove unnecessary regex match and if block. More efficient. location / { root /path/to/root/of/static/files; try_files $uri $uri/ @apachesite; expires max; access_log off; } location @apachesite { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:8080; } Update: The assumption of this config is that … Read more

Proxy with express.js

request has been deprecated as of February 2020, I’ll leave the answer below for historical reasons, but please consider moving to an alternative listed in this issue. Archive I did something similar but I used request instead: var request = require(‘request’); app.get(“https://stackoverflow.com/”, function(req,res) { //modify the url in any way you want var newurl=”http://google.com/”; request(newurl).pipe(res); … Read more

What’s the difference between a proxy server and a reverse proxy server? [closed]

The previous answers were accurate, but perhaps too terse. I will try to add some examples. First of all, the word “proxy” describes someone or something acting on behalf of someone else. In the computer realm, we are talking about one server acting on the behalf of another computer. For the purposes of accessibility, I … Read more