We're working on application with multiple developers.
In order for us to all test on the same dev server we're using a sites style setup:
i.e. https://thisisourdomain.com/node/developerid/
Where "developerid" is their username on the system.
Example: Lets say my id is raymondlc
https://thisisourdomain.com/node/raymondlc should load my source code (I'm running the application on a specific port) with the redirect being handled by Apache.
As it stands, Apache performs the redirect however if we don't adjust the baseURL the the generated app.js, and /img/ directories have invalid paths (they are fetched at https://thisisourdomain.com/app.[hash].js and https://thisisourdomain.com/img/image_name.png).
I've tried changing:
router: {
base: "/"
...
to
router: {
base: "/node/raymondlc/"
...
However this results in "Cannot GET /" when I visit https://thisisourdomain.com/node/raymondlc in the browser.
We CANNOT use subdomains i.e. https://raymondlc92.thisisourdomain.com/ as:
1) We don't control our DNS (it's managed by the institution) so we must add manual redirects to each subdomain.
2) We use HTTPS and our cert does not apply to *.thisisourdomain.com
Just for some clarification I've tried routing the new base many ways besides what I initially posted:
router: {
base: "node/chastainrl"
...
router: {
base: "node/chastainrl/"
...
I've also tried the same various permutations but by escaping the slashes. None of this had any effect (I only vaguely hoped it would) can I get a confirmation that this is/isn't possible?
I can confirm that this is not working, we change the path to https://thisisourdomain.com/node/developerid/ and base to "/developerid/" and it still does not work.
Attempting to visit the URL in question gives "Cannot GET /"
This remains an active issue.
@RaymondLC92
You can try this.
router: {
base: "./node/chastainrl"
...
I usually use this method when not deploying in the root directory.
Or you can try this.
router: {
base: "./"
...
I'm not sure whether it's useful.=.=
@henyuan I'll give it a shot
@henyuan Unfortunately this still results in "Cannot GET /"
Hello,
I have the same problem : I want to publish to www.mywebsite.com/myApp, but when I generate the static app and push it to my server, I get 404s because it searches for www.mywebsite.com/_nuxt/... instead of www.mywebsite.com/myApp/_nuxt/...
How should I indicate that it's published on a subdomain ?
Thanks in advance !
you can set nuxt.config.js {router: base: '/myApp/'}.
look this https://nuxtjs.org/api/configuration-router
API: The router Property - Nuxt.jshttps://nuxtjs.org/api/configuration-router
The router property lets you customize nuxt.js router.
nuxtjs.org
There are documents on this official document.
If this is still wrong after packing, you can try to change it to
{router: base: './'}.
I can only help you here. That's the way I deal with this kind of problem.
good lucky.
发件人: devmtis notifications@github.com
发送时间: 2017年12月15日 15:18
收件人: nuxt/nuxt.js
抄送: henyuan; Mention
主题: Re: [nuxt/nuxt.js] Setting baseUrl (#1947)
Hello,
I have the same problem : I want to publish to www.mywebsite.com/myApphttp://www.mywebsite.com/myApp, but when I generate the static app and push it to my server, I get 404s because it searches for www.mywebsite.com/_nuxt/http://www.mywebsite.com/_nuxt/... instead of www.mywebsite.com/myApp/_nuxt/http://www.mywebsite.com/myApp/_nuxt/...
How should I indicate that it's published on a subdomain ?
Thanks in advance !
―
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/nuxt/nuxt.js/issues/1947#issuecomment-352030964, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ARBO_Z_5CRBd2h7Uj78wgoLCkdrG29Xbks5tAo2tgaJpZM4QFPFm.
@henyuan While I cannot respond for devinitis I can confirm that for me neither of those solutions work.
After a lot of debugging to make the other plugins work too, it works with base: '/myApp/' ! Thanks a lot for your answer @henyuan :)
@RaymondLC92 Have you tried this, with the slash at the beginning ?
base: '/node/chastainrl/'
@devmtis We've ditched the 'node' segment of it as to make it simpler:
I've tried:
router: {
base: "/chastainrl/"
router: {
base: "chastainrl/"
router: {
base: "/chastainrl"
router: {
base: "./chastainrl"
router: {
base: "chastainrl"
All of which result in a message saying:
Cannot GET /
Is there anything that needs to be done on the apache side of things?
@RaymondLC92
Can you provide the wrong message for the console?
Maybe you should try visiting nuxtjs's static resources to determine whether the path is correct.
If the page returns to cannot get, maybe the program itself is wrong?
Because Apache should return to 404 not found if URL is wrong.
My English is not very good, I hope you can understand the meaning of my expression.
I was having the similar issue. The router base: './' fixed the static content references generated via
npm run generate
but then broke the web server when you run either
npm run dev
npm run start
with the error Cannot GET /
Which is fixed changing the router to base: '/' but breaks any static files generated later.
It looks like It could be a small mismatch on how 'generate' static content organises root file paths compared to how the web server does it.
Also with @RaymondLC92 issue isn't it just a case of using the web server to point at www.example.com/example
I'm not familiar with Apache so I'll use an nginx example.
You would configure the nginx location with /example and then point at the localhost:3000 or the folder with the static files generated in dist. To produce the final result www.example.com/example
If you would do it directly in nuxt it would be in the pages folder and you would create a sub folder and its own index.vue file but then in the same app you would have the top level index.vue hosting the main front page with each sub folder modifying the URL
More info on that here:
https://nuxtjs.org/guide/routing#dynamic-routes
i have some problem. try it.
base: "/node/raymondlc//"
@RaymondLC92 have you tried also using builder.extend()
to set config.output.publicPath
?
builder: {
extend (config, { isDev }) {
if (!isDev) {
config.output.publicPath = './_nuxt/'
cc @Atinux am I looking at this the right way? :)
@galvez I'll give it a look, as of yet I haven't tried that.
@galvez This appears to be working.
@RaymondLC92 cool! I'll close this issue now then.
This bug-report has been cancelled by @Atinux.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Hello,
I have the same problem : I want to publish to www.mywebsite.com/myApp, but when I generate the static app and push it to my server, I get 404s because it searches for www.mywebsite.com/_nuxt/... instead of www.mywebsite.com/myApp/_nuxt/...
How should I indicate that it's published on a subdomain ?
Thanks in advance !