I am totally new to this proxy stuff so bear with me and may not be using the right terminology
We have setup a proxy to our ec2 instance where we have a few dokku/docker containers that are hosting a few apps. the url for those apps are: http://foo.dokku.abc.domain.com http://bar.dokku.abc.domain.com
We would like to be able to have users only type: http://foo.abc.domain.com http://bar.abc.domain.com
we’ve setup a rewrite for the above urls which works fine. http://foo.abc.domain.com -> http://foo.dokku.abc.domain.com http://bar.abc.domain.com -> http://bar.dokku.abc.domain.com
however we would like it to not actually rewrite the url, we’d like it to preserve the url in the browser.
What can we do to fix this?
thanks
below is the code in /etc/nginx/sites-available/default
server {
listen 80 ;
server_name .dokku.abc.domain.com;
location / {
proxy_pass http://ip-aaa-bbb-ccc-ddd.us-west-1.compute.internal:80;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80 ;
server_name foo.abc.domain.com;
rewrite ^(.*) http://foo.dokku.abc.domain.com;
}
server {
listen 80 ;
server_name bar.abc.domain.com;
rewrite ^(.*) http://bar.dokku.abc.domain.com;
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Instead of a rewrite for your domains you can use a proxy_pass configuration like the one in your .dokku.abc.domain.com configuration. There is no need from what I can see to redirect the user before initiating the proxy. You will also need to make sure that your app itself does not have the other domain name configured or hard-coded into it anywhere as a mismatch in paths or the domain could cause issues.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.