link1096 link1097 link1098 link1099 link1100 link1101 link1102 link1103 link1104 link1105 link1106 link1107 link1108 link1109 link1110 link1111 link1112 link1113 link1114 link1115 link1116 link1117 link1118 link1119 link1120 link1121 link1122 link1123 link1124 link1125 link1126 link1127 link1128 link1129 link1130 link1131 link1132 link1133 link1134 link1135 link1136 link1137 link1138 link1139 link1140 link1141 link1142 link1143 link1144 link1145 link1146 link1147 link1148 link1149 link1150 link1151 link1152 link1153 link1154 link1155 link1156 link1157 link1158 link1159 link1160 link1161 link1162 link1163 link1164 link1165 link1166 link1167 link1168 link1169 link1170 link1171 link1172 link1173 link1174 link1175 link1176 link1177 link1178 link1179 link1180 link1181 link1182 link1183 link1184 link1185 link1186 link1187 link1188 link1189 link1190 link1191 link1192 link1193 link1194 link1195 link1196 link1197 link1198 link1199 link1200 link1201 link1202 link1203 link1204 link1205 link1206 link1207 link1208 link1209 link1210 link1211 link1212 link1213 link1214 link1215 link1216 link1217 link1218 link1219 link1220 link1221 link1222 link1223 link1224 link1225 link1226 link1227 link1228 link1229 link1230 link1231 link1232

[Vue.js] App Engine app.yaml handlers not working as expected

when trying to set up a vue.js application with the vue.js router set in “history” mode. I also want to serve my back end APIs from the same app engine application. (e.g., if a user navigates to /some/path/in/the/app and refreshes the page or shares the link, the application will display the expected page)

here is my app.yaml:

runtime: python37

handlers:
- url: /api/.*
secure: always
script: auto

- url: /css
static_dir: www/css

- url: /js
static_dir: www/js

- url: /semantic
static_dir: www/semantic

- url: /img
static_dir: www/img

- url: /
static_files: www/index.html
upload: www/index.html

- url: /.*
static_files: www/index.html
upload: www/index.html

When I try to hit any of my api endpoints, the static index.html file is served instead of the response from the endpoint.

If the last route is omitted (url: /.*), then the api endpoints are served correctly, but the Vue.js app can only be entered from the “/“ route and the deep links in the application do not work as expected

when not looking to have a script in my application to serve the a static file.

note, this question is similar, but none of the answers addressed my situation:

AppEngine app.yaml config for single page apps

Solution :

The trick was to follow a microservice architecture and split my application into two modules and define the routes in a dispatch.yaml file.

There is a sample project here:

App Engine Modules sample project