question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I really love this project and was trying to deploy it on my personal webserver. I would like to put it in a docker container behind some Apache reverse proxy, like:

<VirtualHost *:443>

ServerName              my-host

SSLCertificateFile      /etc/pki/tls/certs/my-host.crt
SSLCertificateKeyFile   /etc/pki/tls/private/my-host.key
SSLCertificateChainFile /etc/pki/tls/certs/my-host.ca-bundle

ProxyPreserveHost on

  <Location /cex>
    ProxyPass        http://172.17.0.4:10240
    ProxyPassReverse http://172.17.0.4:10240
  </Location>

</VirtualHost>

However, the page frequently fails to load (no CSS), and even if it loads the compilation still fails. This does not happen if I directly access via the docker container’s ip.

Could you please show me how to correctly configure reverse proxy for CE?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bjodahcommented, Aug 9, 2021

For posterity (googling reverse proxy and compiler-explorer lead me to this issue):

With the help of @apmorton (and @partouf) I managed to host a compiler-explorer instance in docker with port 10240 (--publish 10240:10240), and serving it over https under a URL prefix, by using a reverse proxy in my nginx server on the same host machine (so that I can share a link like https://example.com/compiler-explorer).

Here’s the relevant nginx config section:

location /compiler-explorer {
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_buffer_size          128k;
        proxy_buffers              4 256k;
        proxy_busy_buffers_size    256k;

        proxy_pass http://127.0.0.1:10240;
}

note that inside the docker container, make sure to edit httpRoot to be /compiler-explorer

This can be achieved e.g. this way:

$ echo "httpRoot=/compiler-explorer">>etc/config/compiler-explorer.defaults.properties
$ make run
0reactions
mattgodboltcommented, Nov 5, 2019

Gonna close this due to inactivity, and I think things worked out, right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is a reverse proxy? | Proxy servers explained - Cloudflare
A reverse proxy is a server that sits in front of one or more web servers, intercepting requests from clients. This is different...
Read more >
Reverse proxy - Wikipedia
In computer networks, a reverse proxy is the application that sits in front of back-end applications and forwards client (e.g. browser) requests to...
Read more >
What is a Reverse Proxy Server? - NGINX
A reverse proxy server is a type of proxy server that typically sits behind the firewall in a private network and directs client...
Read more >
What is a Reverse Proxy Server - Imperva
A reverse proxy server is an intermediate connection point positioned at a network's edge. It receives initial HTTP connection requests, acting like the ......
Read more >
How To Set Up a Reverse Proxy (Step-By-Step for Nginx ...
A reverse proxy sits in front of a web server and receives all the requests before they reach the origin server. It works...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found