Skip to content

Instantly share code, notes, and snippets.

@soupmatt
Created July 1, 2011 13:51
Show Gist options
  • Save soupmatt/1058580 to your computer and use it in GitHub Desktop.
Save soupmatt/1058580 to your computer and use it in GitHub Desktop.
Apache reverse proxy config for pow
<VirtualHost *:80>
ServerName pow
ServerAlias *.dev
ServerAlias *.xip.io
ProxyPass / http://localhost:20559/
ProxyPassReverse / http://localhost:20559/
ProxyPreserveHost On
</VirtualHost>
@fojas
Copy link

fojas commented Jun 12, 2012

"ServerAlias *.xip.io" should be added for xip.io support with pow >= 4.0.

@soupmatt
Copy link
Author

ServerAlias *.xip.io added per @fojas

@dorfire
Copy link

dorfire commented Nov 18, 2012

I find this configuration better suited for the userdir module:
https://gist.github.com/4104494

@dobbs
Copy link

dobbs commented Nov 27, 2012

pow intercepts requests intended for the userdir module (e.g. http://localhost/~username). Found my own solution before reading @dorfire's.
This behavior can be suppressed with the following directive inserted before the first ProxyPass

ProxyPassMatch ^/~ !

see https://gist.github.com/4154421

@spencerdcarlson
Copy link

I'm not exactly sure why, but I found that @dorfire 's configuration file worked for me while adding

ProxyPassMatch ^/~ !

as mentioned in https://gist.github.com/4154421 didn't

@ColemanGariety
Copy link

@spencerdcarlson I have the exact opposite problem. Dorfire's solutoon causes apache to server all the request I'd expect pow to make. @dobb's works perfectly, thank you!

@johnpipi
Copy link

If you use nginx instead of apache on osx like I do then this will work:

server {
    listen      80;
    server_name pow *.dev *.xip.io;

    charset utf-8; 
    ignore_invalid_headers on;

    location / {
        proxy_set_header  X-Real-IP  $remote_addr;        
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_set_header Host $host;
        proxy_pass http://localhost:20559/;        
    }    

}

@bobbdelsol
Copy link

I know i'm poking in the dark a bit here, but I've set pow and nginx up per Ryan Bates RailsCast #357. Work great, but of course POW hijacks the localHost. I'm using my localhost http://127.0.0.1 for local storage (simulating my S3 store for production). I've done the revere apache changes, now Apache hijacks the POW ports. i'm sure it's something simple since i'm no webserver expert. Any suggestions. Ryan should include your post in his railscast:)

@allaire
Copy link

allaire commented Nov 21, 2013

Simply add ServerAlias *.ngrok.com for ngrok support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment