I have a rails server running on URL \"http://example.com:1234\" I want to provide the URL of this application to an user as \"http://example.com/myapp\" so that Apache (or
Somethimes it loose it css style. You can use only:
RewriteRule ^myapp(.*) http://example.com:1234 [L,R]
Take a look at setting up a Reverse Proxy under apache.
Apache, listening to port 80 on example.com, would reverse proxy to port 1234. Then requests for http://example.com/myapp would be internally proxied to http://example.com:1234/myapp (or however you setup your ProxyPass target).
If you don't have access to server config, you can use mod_rewrite's Proxy flag and setup some rules inside an .htaccess file. Something along the lines of:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^myapp(.*) http://example.com:1234/$1 [P,L]