How to rewrite URL to another folder using Firebase? - url

I would like to rewrite URL for example myweb.com/index and show content of myweb.com/production/index.com and I want to do that for all pages, that they would be showing content of the same file but in the directory production.
I mean, that Firebase.json would look something like this (of course this doesn't work):
{
"hosting": {
"public": "public",
"cleanUrls": true,
"rewrites": [ {
"source": "**",
"destination": "/production/**"
}
]
}
}

Related

Redirect only if a URL query matches

How to config apple-app-site-association to open/redirect only link with specific url query?
For example I would like to open only links like this https://www.example.com/?modal=CreatePassword
This is my current config an it opens all links even without the url query (modal=CreatePassword)
"applinks": {
"details": [
{
"appIDs": [
"com.app"
],
"components": [
{
"?": {
"modal": "CreatePassword"
}
}
]
}
]
}
I found that iOS keeps/downloads old file even after reinstallation of the app(delete -> install). This video was very helpful: https://youtu.be/xxyEq_ySoO4
I downloaded sysdiagnose file from my iPhone and checked swcutil_show.txt, and found that it keeps old version of the apple-app-site-association file.
The correct config for me:
{
"applinks": {
"details": [
{
"appIDs": [ "com.app" ],
"components": [{
"?":{"modal":"CreatePassword"},
"/":"/"
}
]
}
]
}
}

next.js alias for sibling directory of src

I have this folder structre:
I want to create alias from src to ethereum:
this work fine for "src" directory. in jsconfig.json:
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"#/*": ["/*"]
}
}
}
since ethereum is sibling with src, first I tried this:
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"#/ethereum": ["../ethereum"],
"#/*": ["/*"]
}
}
}
This is saying if you see #/ethereum go outside, find ethereum. this did not work. Then I tried this:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"#/ethereum": ["./ethereum"],
"#/*": ["./src/*"]
}
}
}
that says, if you see "#/ethereum, since base dir is ".", just go to "./ethereum". This did not work either. I am currently moving without "ethereum" alias, but it would be nice to have a consistent project.
Try this maybe:
"baseUrl": ".",
"paths": {
"#/ethereum/*": ["./ethereum/*"],
"#/*": ["./src/*"]
}
}
}
You seem to miss the *. Using "baseUrl": "." is indeed correct.

Serilog not creating log file on production server

I've created a C# .net5.0 console application and during testing Serilog has been working without incident, logging to Console and File (same folder; path="log.txt"). However, when I run on the application on our server, neither Console nor File logging sinks are working! I assume now that the issue is not the sinks themselves but Serilog not actually working.
I've tried enabling the self log:
Serilog.Debugging.SelfLog.Enable(msg =>
Console.WriteLine(msg)
);
but even running in the debugger in my dev environment, the Console.WriteLine(msg) line is never called!
My appsettings.json is as follows:
{
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Information",
"System": "Information"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console",
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {NewLine}{Exception}"
}
},
{
"Name": "File",
"Args": {
"path": "log.txt",
"rollingInterval": "Infinite",
"outputTemplate": "{Timestamp:HH:mm:ss.fff} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
"shared": false
}
}
],
"Enrich": [ "FromLogContext" ]
},
"Database": {
"Server": "(local)",
"Database": "ActivbaseLive"
},
"Email": {
"SmtpHost": "localhost",
"SmtpPort": 25,
"SmtpSecurityOption": "None",
"SmtpUsername": null,
"SmtpPassword": null,
"SmtpSender": "\"Activbase Learning Platform\" <noreply#activbase.net>"
}
}
I've tried absolute paths (using double backslashes in appsettings.json).
I've tried pre-creating the log file (e.g. log.txt and log200428.txt) and setting permissions to Everyone Full Control but neither of these changes fix the problem and they don't explain why the Console sink doesn't write either.
Here is how Serilog is being configured during start-up which is where I suspect the problem is (even through it works in dev environment):
return Host.CreateDefaultBuilder()
.ConfigureLogging(logging =>
{
logging.ClearProviders();
})
.UseSerilog((hostContext, loggerConfiguration) =>
{
loggerConfiguration.ReadFrom.Configuration(hostContext.Configuration);
})
.ConfigureAppConfiguration((hostContext, builder) =>
{
builder.AddEnvironmentVariables();
})
.ConfigureServices(services =>
{
services.AddHostedService<Worker>();
...
});
}
Any ideas why Serilog isn't working in production?
The Path you provide should be absolute.
Some thing like this:
"path": "E:/wwwroot/QA/BackgroundWorkerService/Logs/logFile_.log"
Even I had the same issue, the above fix worked fine for me...
For my api application running in IIS: I had to assign the following permissions to the log folder for the IIS_IUSRS. I didn't need an absolute path!

Why does my browser extension do nothing on page load (except in the toolbox)?

I've been trying to make a Firefox extension. I've had success with doing stuff after a user interaction (like a browser action). But I want my extension to do something without user interaction. But no matter what I do, I can't get anything to happen on page load. Here is my super reduced code:
manifest.json
{
"name": "Test",
"version": "0.1",
"manifest_version": 2,
"background": {
"scripts": ["test.js"]
}
}
test.js
document.addEventListener("DOMContentLoaded", init);
function init() {
document.body.innerHTML = "Hello world!";
}
What am I doing wrong here? It works in the toolbox, just not anywhere else!
I've also tried adding host permissons like this:
"permissions": [
"*://*.facebook.com/*"
],
Try this:
manifest.json
{
"name": "Test",
"version": "0.1",
"manifest_version": 2,
"background": {
"scripts": ["background.js"]
},
"permissions": ["webNavigation", "*://*.facebook.com/*"]
}
background.js
browser.webNavigation.onDOMContentLoaded.addListener(handleOnDOMContentLoaded, {
url: [{ hostEquals: 'www.facebook.com' }],
});
function handleOnDOMContentLoaded({ tabId }) {
browser.tabs.executeScript(tabId, { file: 'test.js' });
}
test.js
document.body.innerHTML = 'Hello world!';

What is the purpose "Using" in serilog configuration in appsettings.json?

I am confused about the purpose Using in this configuration.
Unfortunately the keyword "using" is a very common word, so googling gave no usable result:
a) When configuring with code, I see no analogous builder method in the samples, just the .WriteTo() methods
b) It is interesting, I even commented it out, still everything works (both the console, both the file).
Are not the two Name elements under the WriteTo element (namely Console and File) are the two sinks here? Maybe the Using is a namespace to look for the classes? (then why it works when commented out? and also this should mean that both Console sink and File sink is under the namespace Serilog.Sinks.Console)
"Serilog": {
"Using": [ "Serilog.Sinks.Console" ],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Debug",
"System": "Warning"
}
},
"WriteTo": [
{ "Name": "Console" },
{
"Name": "File",
"Args": {
"path": "%TEMP%\\Logs\\mylog.txt"
//"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level:u3}] [Req: {RequestInfo}] {Message}{NewLine}{Exception}"
}
}
]
}

Resources