Question

How to set up Vue deployment properly in apps

Hi guys, I recently set up and Django API using Digital Ocean Apps & I wanted to connect it to a Vue frontend.

When I was running Vue as a static site, it would only call localhost rather than targeting the API_URL which I set in my environment variables. I switched it to a web service, but now I’m getting

Invalid Host Header

whenever I navigate to the web page.

The Django app is deployed using gunicorn, but how should I be deploying the Vue component to allow myself to have a production version of vue running directly from my frontend component?

Currently I’m targeting the frontend with ${APP_URL} and the backend with ${APP_URL}/api.

I tried following the apps tutorial but I’m still a bit lost.


Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @jakesteele54,

The Invalid Host Header issue occurs when your application is set to listen on localhost instead of 0.0.0.0. That error typically indicates that the server isn’t accepting external connections. Please be sure that is set to run on 0.0.0.0.

You also may need to disable host checks as well:

// vue.config.js
module.exports = {
    // options...
    devServer: {
        disableHostCheck: true
    }
}

I hope this helps!

Cheers, Taha Fatima