Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

api proxy on webhosting not working?

made a quick project in quasar/vuejs
here is my config/relevant line

`

// Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#devServer
devServer: {
  proxy: {
    "/api": {
      target: "https://api.jsonbin.io/v3",
      changeOrigin: true,
      rewrite: (path) => path.replace(/^\/api/, ""),
      headers: {
        "x-master-key":
          "my master key",
      },
    },
  },
},

`

so
im able to call the resource using axios the call is simply /api/whatever-i-need
the full call as seen by chrome or whatever is localhost:port/api/whatever-i-need
works fine in development, i get my response

as soon as i upload it online to directadmin or pleks? it does not work
the call is then mywebsite.com/api/whatever-i-need everything looks correct but it can't find the ressource (404)

any way around that?
i know i could use one of my 239423949023 servers as actual api proxy
but nope, i'd rather have it work as intended

im unsure on how to make it work

i sadly can't provide a test website now

im scratching my head for the past day and i dont have idea where to even start

Comments

  • still stuck, tempted to go and use a vps, sucks a bit but guess shared hosting can't handle that? unsure

  • davidedavide Member
    edited December 2023

    404 returned by whom? Check the http headers, maybe another web server is responding

    Edit: or better, check open ports

  • Yep 404 sounds fishy. As @davide said closely inspect the request. Besides getting the wrong server there might also be cross site restrictions shitting on your parade here.

  • @totally_not_banned said:
    As @davide said closely inspect the request.

    Very closely. I recommend to print out every packet on paper in binary code.

    Thanked by 1totally_not_banned
  • @totally_not_banned said:
    Yep 404 sounds fishy. As @davide said closely inspect the request. Besides getting the wrong server there might also be cross site restrictions shitting on your parade here.

    i think im just dumb asf
    somewhere i found this

    By using a devServer proxy, you don’t have to include any domain name, IP address or localhost. Just axios.get(“/api/blablabla”) will do.

    However, this devServer proxy only lives in vue.config.js, which won’t be compiled into production static folder /dist when you run npm build.

Sign In or Register to comment.