Express server issues for index.html, bundle.js, serving index.html for every router (b/c of react-router) and more - express

I have this:
let dir = __dirname + "/dist"
app.use(express.static(dir));
I log out dir and see that the URL is indeed the same location I've compiled (via webpack) my bundle.js. yet if (in Postman) I run a GET for localhost:8080/dist/bundle.js I get a Cannot GET /dist/bundle.js response.

Related

How can I set up a devserver proxy in Vue, but have it ignore local php files?

I have a devserver proxy setup in VueJS that allows me to talk to my website for APIS and get around CORS problems when working in my local devbuild.
However, with this setup, if the requested file exists locally, the local devserver proxy doesn't get the file from my website (which I want it to do for PHP files), it instead tries to load the local PHP file via the Vue devserver.
my vue.config.js file looks like this:
module.exports = {
"transpileDependencies": [
"vuetify"
],
devServer: {
proxy: 'https://www.example.com',
}
}
Is it possible to set up exclusions for specific files, or specific file types (ie PHP files)?

FOSJsRoutingBundle dump with baseurl

I use
php bin/console fos:js-routing:dump -e=prod --target="web/js/fos_js_routes.prod.js"
to dump all routes, but the problem is my production symfony not in root url.
I mean, it place in https://myshop.com/symfonyapp and all generated route dont have /symfonyapp
for example homepage to be / and what I expect is /symfonyapp/
how to set baseurl to dump all route?
You have to setup this variable in the config file:
// config/packages/fos_js_routing.yaml
fos_js_routing:
request_context_base_url: 'symfonyapp/'

apache server only index.html file working all other file are not accessible

We have dedicated server, we move cpanel account from old server to new server.
All sites are working fine on new hosting but one of site which is static is not working.
Only index.html file is working is accessible, all other files (on faulty site ) like images, css, javascript etc gives 404 error. I have checked .htaccess, stop apache rewriting but no effect. It seem all request go to index.html ( only index.html is accessible).
In error logs I get only following error.
softException in Application.cpp:267: File
Caught race condition abuser. attacker: 513, victim: 0 open file
owner: 0, open file: /home/mysite/public_html/images/video-section.png
We have recreated site by removing account from cpanel, but facing same issue.

myPage.com instead of mypage.com/WebContent

I have created my webpage in eclipse as Dynamic Web Project and uploaded the WebContent folder to the server (WebContent contains index.html js, imgs and css). When I call myPage.com, it works only with the url myPage.com/WebContent. Afterthat I have uploaded the content of the folder WebContent directory to the server root. Now when I call myPage.com, it display empty page. mypage.com/index.html display empty page too.
How to upload WebContent, sothat the index.html display woithout using WebContent in the url?
This can be achieved by:
Using URLRewrite. This thing changes URLs according to the patterns you configure. More to read: http://tomcat.apache.org/tomcat-8.0-doc/rewrite.html
Using redirects in the root folder - if someone requested the folder, it automatically sends you to another folder. This can be done by placing index.html in root folder containing: <meta http-equiv="refresh" content="0; url=http://mypage.com/WebContent" />;
Using Virtual Host - description for Tomcat 6.

Rack (Sinatra) App pointing '/' to parent's root when deployed in subfolder

I have a bunch of small sinatra apps, and now I have to publish them under SSL HTTP as well.
I have https://secure.mydomain.com/ and I want to publish those apps in subdirectories:
/app1
/app2
I followed Phusion Passenger instructions here to publish in subdirs, but inside each application '/' points to root directory.
I don't want to change the code of all apps because, they are already working in non-ssl environment.
What do I need to change to make my application's '/' point to app's root, and not parent's root?
Looks like you just need the url helper method:
url '/' # => https://secure.mydomain.com/app1/