How do I setup a reverse proxy on Cloudflare?

Basically, I'm trying to convert http://149.56.67.129:25585 into https://svexpanded.com/ How would I do this?
36 Replies
DIVISION_Solar
DIVISION_Solar8mo ago
depending on the type of website you could use an nginx reverse proxy:
server {
listen 80 default_server;
client_max_body_size 100M;
server_name <your domain (optional)>;

location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 80 default_server;
client_max_body_size 100M;
server_name <your domain (optional)>;

location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Beny
Beny8mo ago
Or workers:
fetch(request) {
const url = new URL(request.url)
url.host = "149.56.67.129:25585"
return fetch(url, request)
}
fetch(request) {
const url = new URL(request.url)
url.host = "149.56.67.129:25585"
return fetch(url, request)
}
Someone
SomeoneOP8mo ago
Is this possible going through just Cloudflare? I do not have the resources currently to setup a VPS and nginx reverse proxy
DIVISION_Solar
DIVISION_Solar8mo ago
you could use cf workers
Someone
SomeoneOP8mo ago
I'll test out this:
fetch(request) {
const url = new URL(request.url)
url.host = "149.56.67.129:25585"
return fetch(url, request)
}
fetch(request) {
const url = new URL(request.url)
url.host = "149.56.67.129:25585"
return fetch(url, request)
}
hm Could you expand on that a bit more? Not quite sure what you mean hahaha
RyanKnack
RyanKnack8mo ago
Do you have access to the domain name you bought Add that domain name to CloudFlare https://dash.cloudflare.com/?to=/:account/add-site
Someone
SomeoneOP8mo ago
Already added, yes
RyanKnack
RyanKnack8mo ago
Do you have the DNS records set up for proxying? Type: A Name: @ Target: 149.56.67.129
Someone
SomeoneOP8mo ago
Yes, that has been added
RyanKnack
RyanKnack8mo ago
So now you need to overwrite the port from 80 (HTTP)/443 (HTTPS) to your specified port (25585) Under rules > origin rules > new Should be "all Incoming requests" then "overwrite to 25585"
Someone
SomeoneOP8mo ago
@RyanKnack
No description
Someone
SomeoneOP8mo ago
Just did it. Doesn't appear to be working quite yet- could it take some time? ohhh i see i needed to proxy the A record
RyanKnack
RyanKnack8mo ago
I think you may need to configure the DNS on your server side as well Can I see your DNS entries
Someone
SomeoneOP8mo ago
I had it on DNS only, Proxied works :D
No description
RyanKnack
RyanKnack8mo ago
Ooh so it works now? Ayyy works on my end as well
Someone
SomeoneOP8mo ago
Just to make sure, you're getting Main Page Here or something like that
RyanKnack
RyanKnack8mo ago
Yuh
Someone
SomeoneOP8mo ago
perfecttt
Someone
SomeoneOP8mo ago
my cache must be screwed up 😂
No description
Someone
SomeoneOP8mo ago
works on my phone though 🙏
RyanKnack
RyanKnack8mo ago
Not sure how to bypass browser cache but on windows it is Ctrl + F5
Someone
SomeoneOP8mo ago
Safari is dumb, even when I empty caches it still persists lol
RyanKnack
RyanKnack8mo ago
It's a HTML page for now right?
Someone
SomeoneOP8mo ago
Yep!
RyanKnack
RyanKnack8mo ago
CF doesn't cache HTML by default so it should just be your browser cache But if it works on your other device and on my end I do see the page you wanted So it works Oh try incognito
Someone
SomeoneOP8mo ago
Someone
SomeoneOP8mo ago
works! Just gotta properly make the webpage now and not all in flask... hope to get a frontend in tsx/react and backend in python
RyanKnack
RyanKnack8mo ago
:D Aight have fun!
Someone
SomeoneOP8mo ago
Thank you so much for your help! ❤️
RyanKnack
RyanKnack8mo ago
No probs!
Someone
SomeoneOP8mo ago
Should I just close this channel or how does it work here? Usually there's a bot that has a command, but not sure hahaha
RyanKnack
RyanKnack8mo ago
I think you can just leave it here. The answers are all indexed to the web. Mark it as solved would be helpful
Someone
SomeoneOP8mo ago
Got it. Thank you again! I've been paying $7/month for the past year or so for a nginx reverse proxy vps, this is going to save way too much money 😂
RyanKnack
RyanKnack8mo ago
CF free :lul:
Someone
SomeoneOP8mo ago
Best free service I've ever used :happy:
qwq6187
qwq61878mo ago
guys, does anyone tried setting up custom domain on google cloud using proxied A or CNAME Record in Cloudflare? Would that work? Or it needs to be dns-only
Want results from more Discord servers?
Add your server